diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-11-12 13:42:43 -0600 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-11-12 13:43:49 -0600 |
| commit | c81a403fefcde5545bd7d41c66efb7b658d166f5 (patch) | |
| tree | 1aeca354b2cd5a65358f3e63255ee77e91f911e7 /src | |
| parent | eff9f607bb3990dabd62536ef3511414033587db (diff) | |
| download | flake8-c81a403fefcde5545bd7d41c66efb7b658d166f5.tar.gz | |
Exit non-zero if something goes wrong during a run
If we handle an exception, or early exit, or really anything, we should
exit non-zero (and we used to). This was a minor oversight.
Closes #209
Closes #248
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/main/application.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 88db0a8..4765ee1 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -102,6 +102,9 @@ class Application(object): #: The total number of errors before accounting for ignored errors and #: lines. self.total_result_count = 0 + #: Whether or not something catastrophic happened and we should exit + #: with a non-zero status code + self.catastrophic_failure = False #: Whether the program is processing a diff or not self.running_against_diff = False @@ -119,7 +122,8 @@ class Application(object): print(self.result_count) if not self.options.exit_zero: - raise SystemExit(self.result_count > 0) + raise SystemExit((self.result_count > 0) or + self.catastrophic_failure) def find_plugins(self): # type: () -> NoneType @@ -321,5 +325,7 @@ class Application(object): LOG.critical('Caught keyboard interrupt from user') LOG.exception(exc) self.file_checker_manager._force_cleanup() + self.catastrophic_failure = True except exceptions.EarlyQuit: + self.catastrophic_failure = True print('... stopped while processing files') |
