From 7e979602c7723f16e03b5b8a1341266b1d7976dd Mon Sep 17 00:00:00 2001 From: MAHMETT Date: Sun, 8 Mar 2026 00:47:34 +0700 Subject: [PATCH] fix: only raise exception on command failure with stderr output - Change run() function to check returncode before raising exception - Use re.search() instead of re.match() for ignore pattern matching - Fix false positive errors from waydroid informational stderr messages Co-authored-by: Qwen-Coder --- tools/helper.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/helper.py b/tools/helper.py index a4dd78b..d3a7584 100644 --- a/tools/helper.py +++ b/tools/helper.py @@ -33,16 +33,16 @@ def get_data_dir(): # execute on host def run(args: list, env: Optional[str] = None, ignore: Optional[str] = None): result = subprocess.run( - args=args, - env=env, - stdout=subprocess.PIPE, + args=args, + env=env, + stdout=subprocess.PIPE, stderr=subprocess.PIPE ) # print(result.stdout.decode()) - if result.stderr: + if result.returncode != 0 and result.stderr: error = result.stderr.decode("utf-8") - if ignore and re.match(ignore, error): + if ignore and re.search(ignore, error): return result Logger.error(error) raise subprocess.CalledProcessError(