mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
Delete partially-written file in the event of an error.
This commit is contained in:
parent
ede328a784
commit
a163f8813e
@ -342,8 +342,17 @@ if __name__ == '__main__':
|
|||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
if out_path:
|
if out_path:
|
||||||
with open(out_path, 'w') as out_file:
|
try:
|
||||||
mkdoc(args, out_file)
|
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:
|
else:
|
||||||
mkdoc(args)
|
mkdoc(args)
|
||||||
except NoFilenamesError:
|
except NoFilenamesError:
|
||||||
|
Loading…
Reference in New Issue
Block a user