Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90086d7

Browse files
committed
MNT: update how subprocess is called
1 parent 0c6472a commit 90086d7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

examples/tests/backend_driver_sgskip.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
def run(arglist):
5656
try:
57-
ret = subprocess.call(arglist)
57+
ret = subprocess.check_output(arglist)
5858
except KeyboardInterrupt:
5959
sys.exit()
6060
else:
@@ -139,12 +139,15 @@ def drive(backend, directories, python=[sys.executable], switches=[]):
139139
tmpfile.close()
140140
start_time = time.time()
141141
program = [x % {'name': basename} for x in python]
142-
ret = run(program + [tmpfile_name] + switches)
143-
end_time = time.time()
144-
print("%s %s" % ((end_time - start_time), ret))
145-
os.remove(tmpfile_name)
146-
if ret:
142+
try:
143+
ret = run(program + [tmpfile_name] + switches)
144+
except subprocess.CalledProcessError:
147145
failures.append(fullpath)
146+
finally:
147+
end_time = time.time()
148+
print("%s %s" % ((end_time - start_time), ret))
149+
os.remove(tmpfile_name)
150+
148151
return failures
149152

150153

0 commit comments

Comments
 (0)