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
pull/6880/merge
Toshio Kuratomi 7 years ago
parent 966b5fd1a0
commit 80c1765653

@ -345,7 +345,7 @@ if __name__ == '__main__':
finally:
try:
shutil.rmtree(temp_path)
except OSError:
except (NameError, OSError):
# tempdir creation probably failed
pass
sys.exit(exitcode)

Loading…
Cancel
Save