Bug 1475058 - Send SIGINT when interrupting interactive in mach before sending SIGKILL. r=mshal

MozReview-Commit-ID: 2XxLyNi1ZuS

--HG--
extra : rebase_source : d91eed728446219da6be78e310b1a12b597a0d99
This commit is contained in:
Chris Manchester 2018-07-12 11:50:48 -07:00
parent 10f6df7c1f
commit 7edeeaa646

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import, unicode_literals
import logging
import os
import signal
import subprocess
import sys
@ -137,11 +138,19 @@ class ProcessExecutionMixin(LoggingMixin):
p.run()
p.processOutput()
status = None
sig = None
while status is None:
try:
status = p.wait()
if sig is None:
status = p.wait()
else:
status = p.kill(sig=sig)
except KeyboardInterrupt:
status = p.kill()
if sig is None:
sig = signal.SIGINT
elif sig == signal.SIGINT:
# If we've already tried SIGINT, escalate.
sig = signal.SIGKILL
if ensure_exit_code is False:
return status