From aa90021fbc3382fdac6171572c85ee07369c91e1 Mon Sep 17 00:00:00 2001 From: David Riley Date: Wed, 5 Apr 2017 13:50:52 -0700 Subject: [PATCH] Set result if sys.exit() is called by subcommand. Allows the finally branch to make sure of the return code. Change-Id: I7a796da5b60269cbd71aad953f1b9bb762b8eef8 --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index c5f1e9c3..f965d7e1 100755 --- a/main.py +++ b/main.py @@ -198,6 +198,10 @@ class _Repo(object): else: print('error: project group must be enabled for the project in the current directory', file=sys.stderr) result = 1 + except SystemExit as e: + if e.code: + result = e.code + raise finally: elapsed = time.time() - start hours, remainder = divmod(elapsed, 3600)