summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/driver/testlib.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 2155f0ad78..7a2498c347 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -4,13 +4,19 @@
import sys
import os
-import subprocess
import string
import re
import traceback
import copy
import glob
+have_subprocess = False
+try:
+ import subprocess
+ have_subprocess = True
+except:
+ print "Warning: subprocess not found, will fall back to spawnv"
+
from string import join
from testglobals import *
from testutil import *
@@ -1052,11 +1058,19 @@ def runCmd( cmd ):
assert config.timeout_prog!=''
if config.timeout_prog != '':
- # We use subprocess.call rather than os.spawnv as the latter
+ # We prefer subprocess.call to os.spawnv as the latter
# seems to send its arguments through a shell or something
# with the Windows (non-cygwin) python. An argument "a b c"
# turns into three arguments ["a", "b", "c"].
- r = subprocess.call([config.timeout_prog, str(config.timeout), cmd])
+
+ # However, subprocess is new in python 2.4, so fall back to
+ # using spawnv if we don't have it
+
+ if have_subprocess:
+ r = subprocess.call([config.timeout_prog, str(config.timeout), cmd])
+ else:
+ r = os.spawnv(os.P_WAIT, config.timeout_prog,
+ [config.timeout_prog, str(config.timeout), cmd])
else:
r = os.system(cmd)
return r << 8