diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2017-09-06 15:11:12 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-10-19 16:57:25 +0100 |
commit | 8b3b8acd47da70a5d92fcde1c4919f8558a15e29 (patch) | |
tree | 73ab4cf01c5e3eebdc13772c25b1d975cd0bd212 | |
parent | 66289f8edf426845891f40bb9cf8efa951a8391a (diff) | |
download | sos-8b3b8acd47da70a5d92fcde1c4919f8558a15e29.tar.gz |
[policies] stop execution on Ctrl+C during user input
When pressing Ctrl+C during user input (name and case id), sosreport
treats that as an empty string and starts to collect data. It must
terminate instead.
Catch the KeyboardIntterupt, print a newline (to avoid munging the
terminal too much), and then re-raise the exception to cause the
process to exit.
Allow all other exceptions to propagate up and do not attempt to
continue.
Resolves: #1094
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/policies/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index a641e45f..52afc823 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -432,9 +432,9 @@ class LinuxPolicy(Policy): "that you are generating this " "report for [%s]: ") % caseid) self._print() - except: + except KeyboardInterrupt: self._print() - self.report_name = localname + raise if len(self.report_name) == 0: self.report_name = localname |