From 5cdff00e98202232fe6d8e95e5a0522e4ecea680 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 1 Dec 2024 15:05:41 -0500 Subject: [PATCH] Fix qa_cli running on macOS with the KICAD_RUN_FROM_BUILD_DIR flag set --- qa/tests/cli/utils.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/qa/tests/cli/utils.py b/qa/tests/cli/utils.py index 2139f379a7..6f2277c455 100644 --- a/qa/tests/cli/utils.py +++ b/qa/tests/cli/utils.py @@ -21,6 +21,9 @@ # import difflib +import os +import platform + import cairosvg import logging import subprocess @@ -35,14 +38,26 @@ Image.MAX_IMAGE_PIXELS = 800 * 1024 * 1024 // 4 # Increase limit to ~800MB uncom def run_and_capture( command: list ) -> Tuple[ str, str, int ]: logger.info("Executing command \"%s\"", " ".join( command )) + # MacOS qa_cli uses the installed kicad-cli + if platform.system() == "Darwin": + env = {} + env.update(os.environ) + env.pop('KICAD_RUN_FROM_BUILD_DIR') + proc = subprocess.Popen( command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, - encoding = 'utf-8' + encoding = 'utf-8', + env = env ) out,err = proc.communicate() + if proc.returncode != 0 or len(err) != 0: + logger.info(f"command returned {proc.returncode}") + logger.info(f"stdout: {out}") + logger.info(f"stderr: {err}") + return out, err, proc.returncode def textdiff_files( golden_filepath: str, new_filepath: str, skip: int = 0 ) -> bool: