mirror of
https://github.com/httpie/cli.git
synced 2024-11-21 23:33:12 +01:00
Exit with 0 for --version and --help (closes #293).
This commit is contained in:
parent
0481957715
commit
b2ec4f797f
@ -163,12 +163,17 @@ def main(args=sys.argv[1:], env=Environment()):
|
||||
env.stderr.write('\n')
|
||||
else:
|
||||
raise
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
except KeyboardInterrupt:
|
||||
if traceback:
|
||||
raise
|
||||
env.stderr.write('\n')
|
||||
exit_status = ExitStatus.ERROR
|
||||
|
||||
except SystemExit as e:
|
||||
if e.code != ExitStatus.OK:
|
||||
if traceback:
|
||||
raise
|
||||
env.stderr.write('\n')
|
||||
exit_status = ExitStatus.ERROR
|
||||
except requests.Timeout:
|
||||
exit_status = ExitStatus.ERROR_TIMEOUT
|
||||
error('Request timed out (%ss).', args.timeout)
|
||||
|
@ -14,12 +14,12 @@ class TestHTTPie:
|
||||
|
||||
def test_help(self):
|
||||
r = http('--help', error_exit_ok=True)
|
||||
assert r.exit_status == httpie.ExitStatus.ERROR
|
||||
assert r.exit_status == httpie.ExitStatus.OK
|
||||
assert 'https://github.com/jakubroztocil/httpie/issues' in r
|
||||
|
||||
def test_version(self):
|
||||
r = http('--version', error_exit_ok=True)
|
||||
assert r.exit_status == httpie.ExitStatus.ERROR
|
||||
assert r.exit_status == httpie.ExitStatus.OK
|
||||
# FIXME: py3 has version in stdout, py2 in stderr
|
||||
assert httpie.__version__ == r.stderr.strip() + r.strip()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user