Skip to content

Commit eb614e2

Browse files
wangnuannuannashif
authored andcommitted
scripts: twister: output error message
Sometimes custom script fails, but we can't see the error information in twister log, because the twister uses _ to ignore the stderr. Signed-off-by: Jingru Wang <jingru@synopsys.com>
1 parent 7017678 commit eb614e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,10 @@ def make_device_available(self, serial):
723723
def run_custom_script(script, timeout):
724724
with subprocess.Popen(script, stderr=subprocess.PIPE, stdout=subprocess.PIPE) as proc:
725725
try:
726-
stdout, _ = proc.communicate(timeout=timeout)
726+
stdout, stderr = proc.communicate(timeout=timeout)
727727
logger.debug(stdout.decode())
728+
if proc.returncode != 0:
729+
logger.error(f"Custom script failure: {stderr.decode(errors='ignore')}")
728730

729731
except subprocess.TimeoutExpired:
730732
proc.kill()

0 commit comments

Comments
 (0)