Ensure result file is always written

This commit is contained in:
Kovid Goyal 2020-11-30 11:02:28 +05:30
parent bbb6ad3c32
commit b54aff0383
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -213,7 +213,8 @@ def main():
notifier.start() notifier.start()
result = func(*args, **kwargs) result = func(*args, **kwargs)
if result is not None and os.path.exists(os.path.dirname(resultf)): if result is not None:
os.makedirs(os.path.dirname(resultf), exist_ok=True)
with lopen(resultf, 'wb') as f: with lopen(resultf, 'wb') as f:
f.write(pickle_dumps(result)) f.write(pickle_dumps(result))