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.
This commit is contained in:
+18
-2
@@ -128,11 +128,21 @@ def check_zynq_jtag(
|
|||||||
# ── 3. Run Vivado TCL (stream output to callback) ──────────
|
# ── 3. Run Vivado TCL (stream output to callback) ──────────
|
||||||
tcl = _build_jtag_query_tcl()
|
tcl = _build_jtag_query_tcl()
|
||||||
python_timeout = config.step_timeouts.get("check_env", 120)
|
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:
|
try:
|
||||||
proc = subprocess.Popen(
|
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,
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||||
text=True,
|
text=True,
|
||||||
)
|
)
|
||||||
@@ -163,6 +173,12 @@ def check_zynq_jtag(
|
|||||||
Path(tcl).unlink(missing_ok=True)
|
Path(tcl).unlink(missing_ok=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
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)
|
output = "\n".join(output_lines)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user