Skip to content

Commit

Permalink
Fix recursive call on Windows
Browse files Browse the repository at this point in the history
For some reason sys.argv[0] may contain path to the python wrapper
(hererocks-script.py) or just "hererocks". Use inspect.getsourcefile
to get hererocks file location instead.
  • Loading branch information
mpeterv committed Jan 9, 2017
1 parent 6840fa3 commit 09ea6dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hererocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import argparse
import hashlib
import inspect
import json
import os
import platform
Expand Down Expand Up @@ -1645,7 +1646,7 @@ def setup_vs_and_rerun(vs_version, arch):
argv_name = os.path.join(temp_dir, "argv")
setup_output_name = os.path.join(temp_dir, "setup_out")

script_arg = '"{}"'.format(sys.argv[0])
script_arg = '"{}"'.format(inspect.getsourcefile(main))

if sys.executable:
script_arg = '"{}" {}'.format(sys.executable, script_arg)
Expand Down

0 comments on commit 09ea6dd

Please sign in to comment.