When cleaning up the AnsiBallZ tempdir we need to not fail if the tempdir wasn't created
If the temp directory creation failed in mkdtemp then temp_path is never given a value. This would lead to a NameError exception which would obfuscate the original error (out of disk space being a common one). By catching NameError, python will raise the original exception as we want. Fixes #17215
This commit is contained in:
parent
966b5fd1a0
commit
80c1765653
1 changed files with 1 additions and 1 deletions
|
@ -345,7 +345,7 @@ if __name__ == '__main__':
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(temp_path)
|
shutil.rmtree(temp_path)
|
||||||
except OSError:
|
except (NameError, OSError):
|
||||||
# tempdir creation probably failed
|
# tempdir creation probably failed
|
||||||
pass
|
pass
|
||||||
sys.exit(exitcode)
|
sys.exit(exitcode)
|
||||||
|
|
Loading…
Reference in a new issue