about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2022-07-04 15:57:10 +0100
committerChris Denton <christophersdenton@gmail.com>2022-07-04 15:57:10 +0100
commitb1541ff198d3684c4dfadca02d87677bea04f8c0 (patch)
tree0d5b103c9390c99ac4d866ea971955dbbe46056f
parenta3beeaa84da241f35888338ded6659938206ff13 (diff)
downloadrust-b1541ff198d3684c4dfadca02d87677bea04f8c0.tar.gz
rust-b1541ff198d3684c4dfadca02d87677bea04f8c0.zip
bootstrap.py: Always use `.exe` for Windows
This ensure 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.
-rw-r--r--src/bootstrap/bootstrap.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 3c2f1bdb142..d2d294d9040 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -152,6 +152,10 @@ def run(args, verbose=False, exception=False, is_bootstrap=False, **kwargs):
     if verbose:
         print("running: " + ' '.join(args))
     sys.stdout.flush()
+    # Ensure that the .exe is used on Windoows just in case a Linux ELF has been
+    # compiled in the same directory.
+    if os.name == 'nt' and not args[0].endswith('.exe'):
+        args[0] += '.exe'
     # Use Popen here instead of call() as it apparently allows powershell on
     # Windows to not lock up waiting for input presumably.
     ret = subprocess.Popen(args, **kwargs)