Skip to content

Commit

Permalink
test: helper: Print stdout on timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Vyacheslav Yurkov <[email protected]>
  • Loading branch information
UVV-gh committed Sep 3, 2023
1 parent 191bd51 commit 31bfa4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ def run(command, *, timeout=30):
logger = logger_from_command(command)
logger.info('running: %s', command)

proc = subprocess.run(shlex.split(command), capture_output=True, text=True, check=False,
timeout=timeout)
try:
proc = subprocess.run(shlex.split(command), capture_output=True, text=True, check=False,
timeout=timeout)
except subprocess.TimeoutExpired as e:
for line in e.output.splitlines():
if line:
logger.info('stdout: %s', line)
raise

for line in proc.stdout.splitlines():
if line:
Expand Down

0 comments on commit 31bfa4b

Please sign in to comment.