Bug 795427 - Part 2: Terminate mach silently when KeyboardInterrupt is raised; r=jhammel
authorGregory Szorc <gps@mozilla.com>
Thu, 04 Oct 2012 17:43:56 -0700
changeset 109266 c24a0fd080310af8028084c89cfdf1052a58d38b
parent 109265 a7619ca2db7e5e6a51f65a88387786c9b8583048
child 109314 f224c1768111e486239f9c89e6f5f3f59e2d1599
push id1145
push userpastithas@mozilla.com
push dateMon, 08 Oct 2012 14:21:16 +0000
treeherderfx-team@e7f2e2c944b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs795427
milestone18.0a1
Bug 795427 - Part 2: Terminate mach silently when KeyboardInterrupt is raised; r=jhammel DONTBUILD (NPOTB)
python/mach/mach/main.py
--- a/python/mach/mach/main.py
+++ b/python/mach/mach/main.py
@@ -143,16 +143,19 @@ To see more help for a specific command,
 
             if sys.stdout.encoding is None:
                 sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
 
             if sys.stderr.encoding is None:
                 sys.stderr = codecs.getwriter('utf-8')(sys.stderr)
 
             return self._run(argv)
+        except KeyboardInterrupt:
+            print('mach interrupted by signal or user action. Stopping.')
+            return 1
         finally:
             sys.stdin = orig_stdin
             sys.stdout = orig_stdout
             sys.stderr = orig_stderr
 
     def _run(self, argv):
         parser = self.get_argument_parser()