diff options
author | Steven Knight <knight@baldmt.com> | 2008-10-31 06:08:28 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2008-10-31 06:08:28 (GMT) |
commit | 7af32467718be561f1ccfc4ba643625cdf87d54f (patch) | |
tree | 59367af192a53a2627d742d3d9905598152e00ba /QMTest/TestCmd.py | |
parent | 826b8777978674a0459ed736d37f8a1b33a1ca0b (diff) | |
download | SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.zip SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.tar.gz SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.tar.bz2 |
Move responsibility for extracting the exit status from executed tests
from the TestCommon.py module to the wrapper classes in TestCmd.py
that we use as fallbacks if the subprocess module doesn't exist.
Diffstat (limited to 'QMTest/TestCmd.py')
-rw-r--r-- | QMTest/TestCmd.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 8bf054b..ce77a02 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -181,8 +181,8 @@ version. # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. __author__ = "Steven Knight <knight at baldmt dot com>" -__revision__ = "TestCmd.py 0.31.D001 2008/01/01 09:05:59 knight" -__version__ = "0.31" +__revision__ = "TestCmd.py 0.32.D001 2008/10/30 23:00:04 knight" +__version__ = "0.32" import errno import os @@ -265,7 +265,7 @@ def _caller(tblist, skip): arr = [(file, line, name, text)] + arr atfrom = "at" for file, line, name, text in arr[skip:]: - if name == "?": + if name in ("?", "<module>"): name = "" else: name = " (" + name + ")" @@ -490,7 +490,13 @@ except ImportError: self.stdout.close() self.resultcode = self.stderr.close() def wait(self): - return self.resultcode + resultcode = self.resultcode + if os.WIFEXITED(resultcode): + return os.WEXITSTATUS(resultcode) + elif os.WIFSIGNALED(resultcode): + return os.WTERMSIG(resultcode) + else: + return None else: try: @@ -539,6 +545,14 @@ except ImportError: self.stdin = self.tochild self.stdout = self.fromchild self.stderr = self.childerr + def wait(self, *args, **kw): + resultcode = apply(popen2.Popen3.wait, (self,)+args, kw) + if os.WIFEXITED(resultcode): + return os.WEXITSTATUS(resultcode) + elif os.WIFSIGNALED(resultcode): + return os.WTERMSIG(resultcode) + else: + return None subprocess.Popen = Popen3 |