fakessh: fix shutdown ordering bugs.

pull/35/head
David Wilson 7 years ago
parent 9d17f5b625
commit b22df44bf1

@ -92,6 +92,9 @@ class IoPump(econtext.core.BasicStream):
def close(self): def close(self):
self._closed = True self._closed = True
# If local process hasn't exitted yet, ensure its write buffer is
# drained before lazily triggering disconnect in on_transmit.
if self.transmit_side.fd is not None:
self._broker.start_transmit(self) self._broker.start_transmit(self)
def on_shutdown(self, broker): def on_shutdown(self, broker):
@ -185,7 +188,7 @@ class Process(object):
self.router.broker.start_receive(self.pump) self.router.broker.start_receive(self.pump)
def _on_exit(self, msg, arg): def _on_exit(self, msg, arg):
LOG.info('on_exit: proc = %r', self.proc) LOG.debug('on_exit: proc = %r', self.proc)
if self.proc: if self.proc:
self.proc.terminate() self.proc.terminate()
else: else:
@ -232,7 +235,6 @@ def _start_slave(econtext_, src_id, args):
proc, proc,
) )
#process.control.put(('exit', None))
return process.control_handle, process.stdin_handle return process.control_handle, process.stdin_handle

Loading…
Cancel
Save