core: avoid shutdown() in IoLogger on WSL; closes #333.

issue260
David Wilson 6 years ago
parent 07fefa4067
commit 1d32ed3b5a

@ -108,6 +108,7 @@ try:
except NameError:
BaseException = Exception
IS_WSL = 'Microsoft' in os.uname()[2]
PY3 = sys.version_info > (3,)
if PY3:
b = str.encode
@ -1920,7 +1921,9 @@ class IoLogger(BasicStream):
def on_shutdown(self, broker):
"""Shut down the write end of the logging socket."""
_v and LOG.debug('%r.on_shutdown()', self)
self._wsock.shutdown(socket.SHUT_WR)
if not IS_WSL:
# #333: WSL generates invalid readiness indication on shutdown()
self._wsock.shutdown(socket.SHUT_WR)
self._wsock.close()
self.transmit_side.close()

@ -68,7 +68,6 @@ from mitogen.core import LOG
from mitogen.core import IOLOG
IS_WSL = 'Microsoft' in os.uname()[2]
itervalues = getattr(dict, 'itervalues', dict.values)
if mitogen.core.PY3:
@ -178,7 +177,7 @@ def disable_echo(fd):
old = termios.tcgetattr(fd)
new = cfmakeraw(old)
flags = getattr(termios, 'TCSASOFT', 0)
if not IS_WSL:
if not mitogen.core.IS_WSL:
# issue #319: Windows Subsystem for Linux as of July 2018 throws EINVAL
# if TCSAFLUSH is specified.
flags |= termios.TCSAFLUSH

Loading…
Cancel
Save