tools: automate: Fail early if directory can't be renamed (fixes #2502)

This commit is contained in:
Marshall Greenblatt 2024-10-03 13:36:33 -04:00
parent 2b6f461337
commit 467a0d6a85
1 changed files with 7 additions and 1 deletions

View File

@ -117,7 +117,13 @@ def move_directory(source, target, allow_overwrite=False):
if os.path.exists(source): if os.path.exists(source):
msg("Moving directory %s to %s" % (source, target)) msg("Moving directory %s to %s" % (source, target))
if not options.dryrun: if not options.dryrun:
shutil.move(source, target) try:
# This will fail if |source| and |target| are on different filesystems,
# or if files in |source| are currently locked.
os.rename(source, target)
except OSError:
msg('ERROR Failed to move directory %s to %s' % (source, target))
raise
def is_git_checkout(path): def is_git_checkout(path):