From 94148135abcc397ad0ac4475cf8ef4fa7b73308a Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 10 Feb 2019 17:16:58 +0100 Subject: don't use subprocess.check_output to support python3 < 3.7.0 --- src/allocators.py | 5 +++-- src/benchmark.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/allocators.py b/src/allocators.py index dbf26d1..717c500 100644 --- a/src/allocators.py +++ b/src/allocators.py @@ -12,8 +12,9 @@ allocators = {"libc": {"cmd_prefix" : "", for i, t in enumerate(maybe_allocators): try: - path = subprocess.check_output('whereis lib{} | cut -d":" -f2'.format(t), - shell=True, text=True).strip() + path = subprocess.run('whereis lib{} | cut -d":" -f2'.format(t), + shell=True, stdout=subprocess.PIPE, + universal_newlines=True).stdout.strip() if path != "": allocators[t] = {"cmd_prefix": "", "binary_suffix": "", diff --git a/src/benchmark.py b/src/benchmark.py index 583b05b..7bf709e 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -156,8 +156,10 @@ class Benchmark (object): # Find absolute path of executable binary_end = actual_cmd.find(" ") - binary = subprocess.check_output(["whereis", actual_cmd[0:binary_end]], - universal_newlines=True).split()[1] + binary = subprocess.run(["whereis", actual_cmd[0:binary_end]], + stdout=subprocess.PIPE, + universal_newlines=True).stdout.split()[1] + actual_cmd = binary + actual_cmd[binary_end:] actual_cmd = t["cmd_prefix"] + " " + actual_cmd -- cgit v1.2.3