Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3a30e43

Browse files
committedJan 24, 2025
Merge branch 'fix/diag_exec_cmd' into 'master'
fix(tools): allow to save stdout and stderr if the exec command fails Closes IDF-12099 See merge request espressif/esp-idf!36626
2 parents e65c9a5 + 88c099d commit 3a30e43

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎tools/idf_py_actions/diag_ext.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Apache-2.0
33
import atexit
44
import difflib
@@ -583,17 +583,18 @@ def cmd_exec(args: Dict, step: Dict, recipe: Dict) -> None:
583583

584584
if p.returncode:
585585
warn(f'Exec command "{cmd}" failed with exit code {p.returncode}')
586-
return
586+
if p.stderr:
587+
dbg(f'stderr: "{p.stderr}"')
587588

588-
if stdout:
589+
if stdout and p.stdout:
589590
try:
590591
stdout_path.parent.mkdir(parents=True, exist_ok=True)
591592
with open(stdout_path, 'a' if append else 'w') as f:
592593
f.write(p.stdout)
593594
except Exception:
594595
warn(f'Cannot write exec command "{cmd}" stdout to "{stdout}"')
595596

596-
if stderr:
597+
if stderr and p.stderr:
597598
try:
598599
stderr_path.parent.mkdir(parents=True, exist_ok=True)
599600
with open(stderr_path, 'a' if append else 'w') as f:

0 commit comments

Comments
 (0)
Please sign in to comment.