Commit a163f881 by Dan Committed by Wenzel Jakob

Delete partially-written file in the event of an error.

parent ede328a7
......@@ -342,8 +342,17 @@ if __name__ == '__main__':
break
try:
if out_path:
with open(out_path, 'w') as out_file:
mkdoc(args, out_file)
try:
with open(out_path, 'w') as out_file:
mkdoc(args, out_file)
except:
# In the event of an error, don't leave a partially-written
# output file.
try:
os.unlink(out_path)
except:
pass
raise
else:
mkdoc(args)
except NoFilenamesError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment