From 5faac7a399e766c4677e59295044966723237e0c Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 25 Jun 2021 17:05:22 +0300 Subject: Check for the correct result code When programs terminate with an error, they usually return a -1! --- gn3/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gn3/commands.py b/gn3/commands.py index 14bd295..459ccee 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -78,6 +78,6 @@ def run_cmd(cmd: str) -> Dict: """Run CMD and return the CMD's status code and output as a dict""" results = subprocess.run(cmd, capture_output=True, shell=True, check=False) out = str(results.stdout, 'utf-8') - if results.returncode > 0: # Error! + if results.returncode < 0: # Error! out = str(results.stderr, 'utf-8') return {"code": results.returncode, "output": out} -- cgit v1.2.3