1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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:
Toshio Kuratomi 2017-06-06 07:59:50 -07:00
parent 966b5fd1a0
commit 80c1765653

View file

@ -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)