Skip to content

Commit

Permalink
[utilities] catch SoSTimeoutError in sos_get_command_output
Browse files Browse the repository at this point in the history
When calling collect_cmd_output and timeout is hit, SoSTimeoutError is
raised and never caught (until in plugin wrapper).

Resolves: #3331

Signed-off-by: Pavel Moravec <[email protected]>
  • Loading branch information
pmoravec committed Aug 11, 2023
1 parent 46794f4 commit df49224
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sos/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,15 @@ def _check_poller(proc):

if poller:
while reader.running:
_check_poller(p)
try:
_check_poller(p)
except SoSTimeoutError:
p.terminate()
if to_file:
_output.close()
reader.running = False
return {'status': 124, 'output': reader.get_contents(),
'truncated': reader.is_full}
else:
try:
# override timeout=0 to timeout=None, as Popen will treat the
Expand Down

0 comments on commit df49224

Please sign in to comment.