Commit 01940b0a authored by Mikaël Salson's avatar Mikaël Salson

benchmark-releases.py: compatibility with former Python3 versions

parent 6dd6c7ac
......@@ -85,19 +85,20 @@ def go(cmd, log=None):
flog = sys.stdout
print(cmd, end=' ')
start = resource.getrusage(resource.RUSAGE_CHILDREN)
completed = subprocess.run(cmd, shell=True, stderr=subprocess.STDOUT, stdout=flog)
returncode = subprocess.call(cmd, shell=True, stderr=subprocess.STDOUT, stdout=flog)
end = resource.getrusage(resource.RUSAGE_CHILDREN)
if log:
flog.close()
if completed.returncode:
if returncode:
print('FAILED', end=' ')
stime = end.ru_stime-start.ru_stime
utime = end.ru_utime-start.ru_utime
print('%5.2fu %5.2fs' % (utime, stime))
completed.check_returncode()
if returncode:
raise subprocess.CalledProcessError(returncode, cmd)
return stime + utime
......@@ -217,4 +218,4 @@ if __name__ == '__main__':
if args.benchmark:
bench_all()
show_benchs(sys.stdout)
\ No newline at end of file
show_benchs(sys.stdout)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment