From 5d53ded471f71cbb9bc7e2cb79ab53551919db64 Mon Sep 17 00:00:00 2001 From: Jarkko Jaakola Date: Wed, 16 Oct 2024 14:34:16 +0300 Subject: [PATCH] chore: fix schema tool source layout check return code handling --- src/karapace/backup/backends/v3/schema_tool.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/karapace/backup/backends/v3/schema_tool.py b/src/karapace/backup/backends/v3/schema_tool.py index 94fb45db0..d1bbd4f4f 100644 --- a/src/karapace/backup/backends/v3/schema_tool.py +++ b/src/karapace/backup/backends/v3/schema_tool.py @@ -60,14 +60,10 @@ def relative_path(path: pathlib.Path) -> pathlib.Path: def target_has_source_layout(git_target: str) -> bool: - with subprocess.Popen( - ["git", "show", f"{git_target}:src"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) as cp: - if cp.returncode == 128: - return False - return True + cp = subprocess.run(["git", "show", f"{git_target}:src"], capture_output=True) + if cp.returncode == 128: + return False + return True def check_compatibility(git_target: str) -> None: