Bug 1506928 - [mozharness] Handle KeyboardInterrupt in ScriptMixin. r=gbrown
authorHenrik Skupin <mail@hskupin.info>
Wed, 24 Apr 2019 09:30:41 +0000
changeset 471194 6f64c339a2a8f08693ff62512d6f730b2425dc1d
parent 471193 92e638c435da77351cd0d9900d9e0d9bf85a610f
child 471195 ec3fe3df0985e35f654dbf5854a19fce8b79fe44
push id35912
push userbtara@mozilla.com
push dateThu, 25 Apr 2019 09:46:25 +0000
treeherdermozilla-central@0ec836eceb96 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1506928
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1506928 - [mozharness] Handle KeyboardInterrupt in ScriptMixin. r=gbrown Differential Revision: https://phabricator.services.mozilla.com/D25749
testing/mozharness/mozharness/base/script.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -1451,16 +1451,24 @@ class ScriptMixin(PlatformMixin):
                         """Avoid losing the final lines of the log?"""
                         loop = False
                     while True:
                         line = p.stdout.readline()
                         if not line:
                             break
                         parser.add_lines(line)
                 returncode = p.returncode
+        except KeyboardInterrupt:
+            level = error_level
+            if halt_on_failure:
+                level = FATAL
+            self.log("Process interrupted by the user, killing process with pid %s" % p.pid,
+                     level=level)
+            p.kill()
+            return -1
         except OSError, e:
             level = error_level
             if halt_on_failure:
                 level = FATAL
             self.log('caught OS error %s: %s while running %s' % (e.errno,
                      e.strerror, command), level=level)
             return -1