Skip to content

Commit 09ea6dd

Browse files
committed
Fix recursive call on Windows
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.
1 parent 6840fa3 commit 09ea6dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hererocks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import hashlib
9+
import inspect
910
import json
1011
import os
1112
import platform
@@ -1645,7 +1646,7 @@ def setup_vs_and_rerun(vs_version, arch):
16451646
argv_name = os.path.join(temp_dir, "argv")
16461647
setup_output_name = os.path.join(temp_dir, "setup_out")
16471648

1648-
script_arg = '"{}"'.format(sys.argv[0])
1649+
script_arg = '"{}"'.format(inspect.getsourcefile(main))
16491650

16501651
if sys.executable:
16511652
script_arg = '"{}" {}'.format(sys.executable, script_arg)

0 commit comments

Comments
 (0)