Have runxpcshell ignore SIGINT, so we can CTRL-C hung tests and get stdout/stderr from test.

Bug 520649 - runxpcshelltests.py should propagate SIGINT to unit tests.
r=jwalden
This commit is contained in:
Jason Duell
2009-10-31 02:58:14 +01:00
parent 5038e42b73
commit d74a3597d6

View File

@@ -37,7 +37,7 @@
#
# ***** END LICENSE BLOCK ***** */
import re, sys, os, os.path, logging, shutil
import re, sys, os, os.path, logging, shutil, signal
from glob import glob
from optparse import OptionParser
from subprocess import Popen, PIPE, STDOUT
@@ -232,8 +232,13 @@ def runTests(xpcshell, xrePath=None, symbolsPath=None,
proc = Popen(cmdH + cmdT + xpcsRunArgs,
stdout=pStdout, stderr=pStderr, env=env, cwd=testdir)
# allow user to kill hung subprocess with SIGINT w/o killing this script
# - don't move this line above Popen, or child will inherit the SIG_IGN
signal.signal(signal.SIGINT, signal.SIG_IGN)
# |stderr == None| as |pStderr| was either |None| or redirected to |stdout|.
stdout, stderr = proc.communicate()
signal.signal(signal.SIGINT, signal.SIG_DFL)
if interactive:
# Not sure what else to do here...