Skip to content

Commit

Permalink
Use self.exit
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Mar 18, 2020
1 parent 7fb8631 commit 43fbbd4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ctapipe/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def run(self, argv=None):
self.log.error(f"Caught unexpected exception: {err}")
self.finish()
Provenance().finish_activity(activity_name=self.name, status="error")
exit_status=1 # any other error
exit_status = 1 # any other error
except KeyboardInterrupt:
self.log.warning("WAS INTERRUPTED BY CTRL-C")
self.finish()
Provenance().finish_activity(activity_name=self.name, status="interrupted")
exit_status=130 # Script terminated by Control-C
exit_status = 130 # Script terminated by Control-C
finally:
for activity in Provenance().finished_activities:
output_str = " ".join([x["url"] for x in activity.output])
Expand All @@ -239,8 +239,7 @@ def run(self, argv=None):
with open("provenance.log", mode="w+") as provlog:
provlog.write(Provenance().as_json(indent=3))

sys.exit(exit_status)

self.exit(exit_status)

@property
def version_string(self):
Expand Down

0 comments on commit 43fbbd4

Please sign in to comment.