diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-16 22:28:25 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-16 22:30:29 +0100 |
commit | fbcfcc43e7e4525729616b03ea653c95f7d141c8 (patch) | |
tree | a77fea35876f2a2a942f8c0e9c62ccf1ff1b9e48 | |
parent | 858f6c1d1ed7660daf003752138153c5dcce8dac (diff) | |
download | sos-fbcfcc43e7e4525729616b03ea653c95f7d141c8.tar.gz |
Handle KeyboardInterrupt during policy load
Loading the policy class accounts for most of the time sos spends
before outputing any UI text. Handle Ctrl-C during this period and
exit gracefully.
Fixes Issue #270.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index ee0e2a85..2dac501f 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -526,7 +526,10 @@ class SoSReport(object): self.opts = SoSOptions(args) self._set_debug() self._read_config() - self.policy = sos.policies.load() + try: + self.policy = sos.policies.load() + except KeyboardInterrupt: + self._exit(0) self._is_root = self.policy.is_root() self.tmpdir = os.path.abspath( self.policy.get_tmp_dir(self.opts.tmp_dir)) |