Do not bother with issuing kill-server, simply -KILL tmux

This commit is contained in:
Foo 2017-04-30 03:12:13 +03:00
parent 36b9c966e0
commit b71d5f2d44
2 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import threading
from time import sleep
from itertools import groupby
from signal import SIGKILL
import pexpect
@ -24,6 +25,7 @@ class ExpectProcess(threading.Thread):
self.env = env
self.buffer = []
self.child_lock = threading.Lock()
self.shutdown_event = threading.Event()
def run(self):
child = pexpect.spawn(self.cmd, self.args, cwd=self.cwd, env=self.env)
@ -32,7 +34,7 @@ class ExpectProcess(threading.Thread):
sleep(0.5)
self.child = child
status = None
while status is None:
while status is None and not self.shutdown_event.is_set():
try:
with self.child_lock:
s = child.read_nonblocking(size=1024, timeout=0)
@ -46,6 +48,12 @@ class ExpectProcess(threading.Thread):
self.vterm.push(s)
self.buffer.append(s)
if status is None:
child.kill(SIGKILL)
def kill(self):
self.shutdown_event.set()
def resize(self, rows, cols):
with self.child_lock:
self.rows = rows

View File

@ -306,8 +306,9 @@ def main(attempts=3):
if ret is not None:
return ret
finally:
check_call([tmux_exe, '-S', socket_path, 'kill-server'], env=env,
cwd=VTERM_TEST_DIR)
p.kill()
p.join(10)
assert(not p.isAlive())
return main(attempts=(attempts - 1))