summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-04-04 17:23:44 -0400
committerMike Frysinger <vapier@gentoo.org>2015-04-04 17:23:44 -0400
commit56cf23ea1bd90f9f850691dbf2052cd58aa99a98 (patch)
tree7d4e0d2cbbb8cb4274043c90ce55db3a33d3eab7
parentekeyword: fix unused variable warnings (diff)
downloadgentoolkit-dev-0.3.0.tar.gz
gentoolkit-dev-0.3.0.tar.bz2
gentoolkit-dev-0.3.0.zip
ekeyword: fix crash when passing "" as the archgentoolkit-dev-0.3.0
-rwxr-xr-xsrc/ekeyword/ekeyword.py2
-rwxr-xr-xsrc/ekeyword/ekeyword_unittest.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ekeyword/ekeyword.py b/src/ekeyword/ekeyword.py
index b0035da..7a0cc7d 100755
--- a/src/ekeyword/ekeyword.py
+++ b/src/ekeyword/ekeyword.py
@@ -478,7 +478,7 @@ def main(argv):
if arg in ('--format',):
if argv:
parse_args.append(argv.pop(0))
- elif arg[0] == '-' and len(arg) == 2:
+ elif len(arg) == 2 and arg[0] == '-':
parse_args.append(arg)
else:
work_args.append(arg)
diff --git a/src/ekeyword/ekeyword_unittest.py b/src/ekeyword/ekeyword_unittest.py
index 5141159..134dd80 100755
--- a/src/ekeyword/ekeyword_unittest.py
+++ b/src/ekeyword/ekeyword_unittest.py
@@ -372,6 +372,10 @@ class TestMain(unittest.TestCase):
ekeyword.main(['arm', '--dry-run', os.path.join(TESTDIR, 'process-1.ebuild')])
ekeyword.main(['--version', '--dry-run'])
+ def testEmptyString(self):
+ self.assertRaises(SystemExit, ekeyword.main,
+ ['', os.path.join(TESTDIR, 'process-1.ebuild')])
+
if __name__ == '__main__':
unittest.main()