Mercurial > hg-stable
changeset 20893:b5de9dde181c
revsetbenchmark: remove python 2.7 dependency
revsetbenchmark.py used check_output which only exists in python 2.7. This
fixes it.
author | Durham Goode <durham@fb.com> |
---|---|
date | Mon, 31 Mar 2014 16:29:39 -0700 |
parents | 6fe95448596d |
children | 04e1596d5dbd |
files | contrib/revsetbenchmarks.py |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/revsetbenchmarks.py Mon Mar 24 17:20:15 2014 -0700 +++ b/contrib/revsetbenchmarks.py Mon Mar 31 16:29:39 2014 -0700 @@ -14,8 +14,16 @@ # to compare performance. import sys -from subprocess import check_call, check_output, CalledProcessError, STDOUT +from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE +def check_output(*args, **kwargs): + kwargs.setdefault('stderr', PIPE) + kwargs.setdefault('stdout', PIPE) + proc = Popen(*args, **kwargs) + output, error = proc.communicate() + if proc.returncode != 0: + raise CalledProcessError(proc.returncode, ' '.join(args)) + return output def update(rev): """update the repo to a revision"""