From 43fbbd43b9068ed8397d79357fba3397fe53c812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Wed, 18 Mar 2020 17:24:33 +0100 Subject: [PATCH] Use self.exit --- ctapipe/core/tool.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ctapipe/core/tool.py b/ctapipe/core/tool.py index 52d3ef23f27..23ae30897c5 100644 --- a/ctapipe/core/tool.py +++ b/ctapipe/core/tool.py @@ -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]) @@ -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):