diff options
author | Tim Harder <radhermit@gmail.com> | 2016-02-29 19:58:57 -0500 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2016-02-29 19:58:57 -0500 |
commit | 77c1a98a0f69b9ba771a91cd1e7a150cf2d2c1ad (patch) | |
tree | d44863886413fdc5d8069a8f70b8cced1a3ad9d2 | |
parent | shell/bin/pkgcore-sh-helper: make helper script more shell-agnostic (diff) | |
download | pkgcore-77c1a98a0f69b9ba771a91cd1e7a150cf2d2c1ad.tar.gz pkgcore-77c1a98a0f69b9ba771a91cd1e7a150cf2d2c1ad.tar.bz2 pkgcore-77c1a98a0f69b9ba771a91cd1e7a150cf2d2c1ad.zip |
util/commandline: don't catch SystemExit raised by argparse error()
-rw-r--r-- | pkgcore/test/util/test_commandline.py | 7 | ||||
-rw-r--r-- | pkgcore/util/commandline.py | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/pkgcore/test/util/test_commandline.py b/pkgcore/test/util/test_commandline.py index 93784f103..a5712bc84 100644 --- a/pkgcore/test/util/test_commandline.py +++ b/pkgcore/test/util/test_commandline.py @@ -144,9 +144,10 @@ class MainTest(TestCase): def main(options, out, err): pass - # this is specifically asserting that if given a positional arg (the '1'), - # which isn't valid in our argparse setup, it returns exit code -10. - self.assertMain(-10, '', '', argparser, ['1']) + # This is specifically asserting that if given a positional arg (the + # '1'), which isn't valid in our argparse setup, it returns exit code 2 + # (standard argparse error() exit status). + self.assertMain(2, '', '', argparser, ['1']) def test_configuration_error(self): argparser = commandline.ArgumentParser(suppress=True) diff --git a/pkgcore/util/commandline.py b/pkgcore/util/commandline.py index a51b9df3e..5e60bcac1 100644 --- a/pkgcore/util/commandline.py +++ b/pkgcore/util/commandline.py @@ -609,9 +609,6 @@ def main(parser, args=None, outfile=None, errfile=None): traceback.print_tb(sys.exc_info()[-1]) signal.signal(signal.SIGINT, signal.SIG_DFL) os.killpg(os.getpgid(0), signal.SIGINT) - except SystemExit: - # use our own exit status - pass except compatibility.IGNORED_EXCEPTIONS: raise except errors.ParsingError as e: |