Do not bother with issuing kill-server, simply -KILL tmux
This commit is contained in:
parent
36b9c966e0
commit
b71d5f2d44
|
@ -5,6 +5,7 @@ import threading
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
|
from signal import SIGKILL
|
||||||
|
|
||||||
import pexpect
|
import pexpect
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ class ExpectProcess(threading.Thread):
|
||||||
self.env = env
|
self.env = env
|
||||||
self.buffer = []
|
self.buffer = []
|
||||||
self.child_lock = threading.Lock()
|
self.child_lock = threading.Lock()
|
||||||
|
self.shutdown_event = threading.Event()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
child = pexpect.spawn(self.cmd, self.args, cwd=self.cwd, env=self.env)
|
child = pexpect.spawn(self.cmd, self.args, cwd=self.cwd, env=self.env)
|
||||||
|
@ -32,7 +34,7 @@ class ExpectProcess(threading.Thread):
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
self.child = child
|
self.child = child
|
||||||
status = None
|
status = None
|
||||||
while status is None:
|
while status is None and not self.shutdown_event.is_set():
|
||||||
try:
|
try:
|
||||||
with self.child_lock:
|
with self.child_lock:
|
||||||
s = child.read_nonblocking(size=1024, timeout=0)
|
s = child.read_nonblocking(size=1024, timeout=0)
|
||||||
|
@ -46,6 +48,12 @@ class ExpectProcess(threading.Thread):
|
||||||
self.vterm.push(s)
|
self.vterm.push(s)
|
||||||
self.buffer.append(s)
|
self.buffer.append(s)
|
||||||
|
|
||||||
|
if status is None:
|
||||||
|
child.kill(SIGKILL)
|
||||||
|
|
||||||
|
def kill(self):
|
||||||
|
self.shutdown_event.set()
|
||||||
|
|
||||||
def resize(self, rows, cols):
|
def resize(self, rows, cols):
|
||||||
with self.child_lock:
|
with self.child_lock:
|
||||||
self.rows = rows
|
self.rows = rows
|
||||||
|
|
|
@ -306,8 +306,9 @@ def main(attempts=3):
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
return ret
|
return ret
|
||||||
finally:
|
finally:
|
||||||
check_call([tmux_exe, '-S', socket_path, 'kill-server'], env=env,
|
p.kill()
|
||||||
cwd=VTERM_TEST_DIR)
|
p.join(10)
|
||||||
|
assert(not p.isAlive())
|
||||||
return main(attempts=(attempts - 1))
|
return main(attempts=(attempts - 1))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue