forked from mirrors/gecko-dev
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:
parent
10f6df7c1f
commit
7edeeaa646
1 changed files with 11 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
@ -137,11 +138,19 @@ class ProcessExecutionMixin(LoggingMixin):
|
||||||
p.run()
|
p.run()
|
||||||
p.processOutput()
|
p.processOutput()
|
||||||
status = None
|
status = None
|
||||||
|
sig = None
|
||||||
while status is None:
|
while status is None:
|
||||||
try:
|
try:
|
||||||
|
if sig is None:
|
||||||
status = p.wait()
|
status = p.wait()
|
||||||
|
else:
|
||||||
|
status = p.kill(sig=sig)
|
||||||
except KeyboardInterrupt:
|
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:
|
if ensure_exit_code is False:
|
||||||
return status
|
return status
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue