diff options
Diffstat (limited to 'import_issues.py')
-rwxr-xr-x | import_issues.py | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/import_issues.py b/import_issues.py index c0910ae..93c4128 100755 --- a/import_issues.py +++ b/import_issues.py @@ -171,7 +171,7 @@ def get_labels(tracker: str) -> list[dict[str, str]]: ) except subprocess.CalledProcessError as ex: raise RuntimeError( - f"hut failed with excitcode {ex.returncode} and stderr:\n{ex.stderr}" + f"hut failed with excitcode {ex.returncode}\n\nstdout:\n{ex.stdout}\n\nand stderr:\n{ex.stderr}" ) from ex data = json.loads(ret.stdout) return data["me"]["tracker"]["labels"]["results"] @@ -271,23 +271,28 @@ def run_hut(cmds, tracker, msg, args=None, delay=None): ) if args is None: args = [] - if msg is None: - res = subprocess.run( - ["hut", "todo"] + cmds + ["-t", tracker] + args, - check=True, - encoding="utf-8", - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) - else: - res = subprocess.run( - ["hut", "todo"] + cmds + ["-t", tracker, "--stdin"] + args, - check=True, - encoding="utf-8", - input=msg, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) + try: + if msg is None: + res = subprocess.run( + ["hut", "todo"] + cmds + ["-t", tracker] + args, + check=True, + encoding="utf-8", + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + else: + res = subprocess.run( + ["hut", "todo"] + cmds + ["-t", tracker, "--stdin"] + args, + check=True, + encoding="utf-8", + input=msg, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + except subprocess.CalledProcessError as ex: + raise RuntimeError( + f"hut failed with excitcode {ex.returncode}\n\nstdout:\n{ex.stdout}\n\nand stderr:\n{ex.stderr}" + ) from ex time.sleep(delay) |