Skip to content

Commit a82f4a5

Browse files
authored
Rollup merge of #98895 - ChrisDenton:no-elves-allowed, r=jyn514
bootstrap.py: Always use `.exe` for Windows This ensures that it will run the Windows executable if other files in the directory (such as Linux executables) have the same file name minus the extension. I've been tripped up by this a few times where both `bootstrap` and `bootstrap.exe` end up in the same directory. This PR avoids ever having to see the following message: `OSError: [WinError 193] %1 is not a valid Win32 application`
2 parents 70ade7d + 9ac4a4e commit a82f4a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/bootstrap/bootstrap.py

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def run(args, verbose=False, exception=False, is_bootstrap=False, **kwargs):
152152
if verbose:
153153
print("running: " + ' '.join(args))
154154
sys.stdout.flush()
155+
# Ensure that the .exe is used on Windows just in case a Linux ELF has been
156+
# compiled in the same directory.
157+
if os.name == 'nt' and not args[0].endswith('.exe'):
158+
args[0] += '.exe'
155159
# Use Popen here instead of call() as it apparently allows powershell on
156160
# Windows to not lock up waiting for input presumably.
157161
ret = subprocess.Popen(args, **kwargs)

0 commit comments

Comments
 (0)