env view failures: print underlying error message (#18713)

This commit is contained in:
Greg Becker
2020-09-18 10:21:14 -07:00
committed by GitHub
parent 44c7826892
commit 2e4892c111
2 changed files with 13 additions and 1 deletions

View File

@@ -680,7 +680,7 @@ def replace_directory_transaction(directory_name, tmp_root=None):
try:
yield tmp_dir
except (Exception, KeyboardInterrupt, SystemExit):
except (Exception, KeyboardInterrupt, SystemExit) as e:
# Delete what was there, before copying back the original content
if os.path.exists(directory_name):
shutil.rmtree(directory_name)
@@ -691,6 +691,7 @@ def replace_directory_transaction(directory_name, tmp_root=None):
tty.debug('DIRECTORY RECOVERED [{0}]'.format(directory_name))
msg = 'the transactional move of "{0}" failed.'
msg += '\n ' + str(e)
raise RuntimeError(msg.format(directory_name))
else:
# Otherwise delete the temporary directory