about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index d1aa32236ae..71c1c61e3d9 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -308,7 +308,12 @@ def output(filepath):
     tmp = filepath + '.tmp'
     with open(tmp, 'w') as f:
         yield f
-    os.rename(tmp, filepath)
+    try:
+        os.remove(filepath)  # PermissionError/OSError on Win32 if in use
+        os.rename(tmp, filepath)
+    except OSError:
+        shutil.copy2(tmp, filepath)
+        os.remove(tmp)
 
 
 class RustBuild(object):