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

Skip to content

Commit 1a651a2

Browse files
tacaswelldstansby
authored andcommitted
MNT: update how subprocess is called
1 parent ff86975 commit 1a651a2

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
@@ -53,7 +53,7 @@
5353

5454
def run(arglist):
5555
try:
56-
ret = subprocess.call(arglist)
56+
ret = subprocess.check_output(arglist)
5757
except KeyboardInterrupt:
5858
sys.exit()
5959
else:
@@ -133,12 +133,15 @@ def drive(backend, directories, python=[sys.executable], switches=[]):
133133
tmpfile.close()
134134
start_time = time.time()
135135
program = [x % {'name': basename} for x in python]
136-
ret = run(program + [tmpfile_name] + switches)
137-
end_time = time.time()
138-
print("%s %s" % ((end_time - start_time), ret))
139-
os.remove(tmpfile_name)
140-
if ret:
136+
try:
137+
ret = run(program + [tmpfile_name] + switches)
138+
except subprocess.CalledProcessError:
141139
failures.append(fullpath)
140+
finally:
141+
end_time = time.time()
142+
print("%s %s" % ((end_time - start_time), ret))
143+
os.remove(tmpfile_name)
144+
142145
return failures
143146

144147

0 commit comments

Comments
 (0)