From 1af042d57076e6cf5eb7f325414ccbf28e758ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Seznec?= Date: Thu, 10 Feb 2022 07:19:27 -0800 Subject: [PATCH] compatibility with old subprocess.run API subprocess.run has added support for capture_output only in python 3.7. Even if python <=3.6 is officially out of support, users can still encounter it on Slurm frontends, where stui is likely to be used. --- stui/backend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stui/backend.py b/stui/backend.py index aed69da..f678bc9 100644 --- a/stui/backend.py +++ b/stui/backend.py @@ -177,10 +177,10 @@ def _run_command(self, cmd: str): o = results.stdout.splitlines() else: cmd = f"ssh {self.remote} {cmd}" - process = subprocess.run(cmd.split(" "), capture_output=True) + process = subprocess.run(cmd.split(" "), stdout=subprocess.PIPE) o = process.stdout.decode("utf-8").splitlines() else: - process = subprocess.run(cmd.split(" "), capture_output=True) + process = subprocess.run(cmd.split(" "), stdout=subprocess.PIPE) o = process.stdout.decode("utf-8").splitlines() # TODO: for some reason lines are surrounded by quotes when not using SSH o = [line.strip('"') for line in o]