[StGit PATCH] Handle commandline parsing errors gracefully

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The commandline option parser raises SystemExit after having explained
to the user what she did wrong. A recent refactoring introduced a
catch-all "except:" at the top level, which caught the SystemExit and
printed a traceback.

Let's just simply exit instead, like we used to.

Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx>

---

This goes on the "master" branch.

 stgit/main.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/stgit/main.py b/stgit/main.py
index 663fdec..aa1f8ef 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -281,6 +281,10 @@ def main():
         if debug_level > 0:
             traceback.print_exc()
         sys.exit(utils.STGIT_COMMAND_ERROR)
+    except SystemExit:
+        # Triggered by the option parser when it finds bad commandline
+        # parameters.
+        sys.exit(utils.STGIT_COMMAND_ERROR)
     except KeyboardInterrupt:
         sys.exit(utils.STGIT_GENERAL_ERROR)
     except:

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux