Rahix / tbot

Automation/Testing tool for Embedded Linux Development
https://tbot.tools
GNU General Public License v3.0
84 stars 21 forks source link

fix stalled subprocess close #104

Closed Mike8 closed 11 months ago

Mike8 commented 11 months ago

This fix is possibly related to the problem described in #94 by @yanivy-nr.

It happens from time to time that subprocess close() stalls forever. I guess the reason is a raise conditions when terminating the process and closing the piped streams.

A note in Python's subprocess documentation suggests to use following code snipped to properly terminate/kill a subprocess:

proc = subprocess.Popen(...)
try:
    outs, errs = proc.communicate(timeout=15)
except TimeoutExpired:
    proc.kill()
    outs, errs = proc.communicate()
codecov[bot] commented 11 months ago

Codecov Report

Patch coverage is 40.00% of modified lines.

Files Changed Coverage
tbot/machine/channel/subprocess.py 40.00%

:loudspeaker: Thoughts on this report? Let us know!.