浏览代码

use shutil.move instead of os.rename to move file

This prevents a "OSError: [Errno 18] Invalid cross-device link" if the temporary
file was created on different filesystem (such as a tmpfs mount).
Daniël van de Giessen 7 月之前
父节点
当前提交
ba250a3075
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      scripts/changeprefix.py

+ 1 - 1
scripts/changeprefix.py

@@ -73,7 +73,7 @@ def changefile(from_prefix, to_prefix, from_path, to_path, *,
         shutil.copystat(from_path, to_path)
 
     if to_path_temp:
-        os.rename(to_path, from_path)
+        shutil.move(to_path, from_path)
     elif from_path != '-':
         os.remove(from_path)