diff --git a/tbot/machine/channel/subprocess.py b/tbot/machine/channel/subprocess.py index 8052ab09..733d0141 100644 --- a/tbot/machine/channel/subprocess.py +++ b/tbot/machine/channel/subprocess.py @@ -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