Skip to content

Commit

Permalink
FIX: Only remove temporary folder if it is present (#4379)
Browse files Browse the repository at this point in the history
This was causing an error, when running the tests/engine/test_calc_job.py on OSX,
since here it is not guaranteed the temporary folder will be created.
  • Loading branch information
chrisjsewell authored Oct 27, 2020
1 parent 9460e4e commit 02c8a0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiida/engine/processes/calcjobs/calcjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ def parse(self, retrieved_temporary_folder=None):
try:
exit_code_retrieved = self.parse_retrieved_output(retrieved_temporary_folder)
finally:
shutil.rmtree(retrieved_temporary_folder, ignore_errors=True)
if retrieved_temporary_folder is not None:
shutil.rmtree(retrieved_temporary_folder, ignore_errors=True)

if exit_code_retrieved is not None and exit_code_retrieved.status > 0:
msg = f'output parser returned exit code<{exit_code_retrieved.status}>: {exit_code_retrieved.message}'
Expand Down

0 comments on commit 02c8a0c

Please sign in to comment.