Skip to content

Commit

Permalink
channel: subprocess: Kill unresponsive subprocesses
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike8 authored Sep 21, 2023
1 parent 5f36a57 commit c691f21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tbot/machine/channel/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def close(self) -> None:
self.p.terminate()
os.close(self.pty_slave)
os.close(self.pty_master)
self.p.wait()
try:
self.p.communicate(timeout=10)
except subprocess.TimeoutExpired:
self.p.kill()
self.p.communicate()

# Wait for all processes in the session to end. Most of the time
# this will return immediately, but in some cases (eg. a serial session
Expand Down

0 comments on commit c691f21

Please sign in to comment.