diff options
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 66c4a0caa17..e90245f43ec 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -102,7 +102,20 @@ def check_call(*args, **kwargs): print(' '.join(args[0])) # we have to use shell=True in order to get PATH handling # when looking for the binary on Windows - return subprocess.check_call(*args, shell=sys.platform == 'win32', **kwargs) + proc = subprocess.Popen(*args, shell=sys.platform == 'win32', **kwargs) + status = None + # Leave it to the subprocess to handle Ctrl+C. If it terminates as + # a result of Ctrl+C, proc.wait() will return a status code, and, + # we get out of the loop. If it doesn't, like e.g. gdb, we continue + # waiting. + while status is None: + try: + status = proc.wait() + except KeyboardInterrupt: + pass + + if status: + raise subprocess.CalledProcessError(status, ' '.join(*args)) def is_windows(): |