Skip to content

Commit

Permalink
fix exit_code for click.testing.CliRunner.invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
timfeirg committed Feb 21, 2017
1 parent 8d9dd46 commit 2a9762f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions click/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,13 @@ def invoke(self, cli, args=None, input=None, env=None,

exit_code = e.code
if not isinstance(exit_code, int):
sys.stdout.write(str(exit_code))
if exit_code is None:
exit_code = 0
else:
exit_code = 1

sys.stdout.write(str(e.code))
sys.stdout.write('\n')
exit_code = 1
except Exception as e:
if not catch_exceptions:
raise
Expand Down

0 comments on commit 2a9762f

Please sign in to comment.