From 7e8427d5226e55457d713eddfe95b06b8a83a95b Mon Sep 17 00:00:00 2001 From: Jeremy Shen Date: Thu, 11 Jun 2026 17:26:41 +0800 Subject: [PATCH] fix: redirect Vivado .jou/.log to temp dir with -tempDir Vivado batch mode creates vivado.jou, vivado.log, and backup files in cwd by default. Use -tempDir to redirect all temp output to the system temp directory, and clean up afterwards. --- src/zynq_checker.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/zynq_checker.py b/src/zynq_checker.py index 56767fd..7dbd5b5 100644 --- a/src/zynq_checker.py +++ b/src/zynq_checker.py @@ -128,11 +128,21 @@ def check_zynq_jtag( # ── 3. Run Vivado TCL (stream output to callback) ────────── tcl = _build_jtag_query_tcl() python_timeout = config.step_timeouts.get("check_env", 120) - output_lines: list[str] = [] + # Redirect Vivado journal/log to temp dir so we don't litter the cwd + tmp = tempfile.gettempdir() + vivado_args = [ + "-mode", "batch", + "-tempDir", tmp, + "-journal", str(Path(tmp) / "vivado_jtag.jou"), + "-log", str(Path(tmp) / "vivado_jtag.log"), + "-source", tcl, + ] + + output_lines: list[str] = [] try: proc = subprocess.Popen( - build_tool_command(vivado_path, "-mode", "batch", "-source", tcl), + build_tool_command(vivado_path, *vivado_args), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, ) @@ -163,6 +173,12 @@ def check_zynq_jtag( Path(tcl).unlink(missing_ok=True) except Exception: pass + # Clean up Vivado temp files we redirected + for f in ("vivado_jtag.jou", "vivado_jtag.log"): + try: + (Path(tmp) / f).unlink(missing_ok=True) + except Exception: + pass output = "\n".join(output_lines)