@ -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,6 +1921,8 @@ 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)
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
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 mitogen.core.IS_WSL:
# issue #319: Windows Subsystem for Linux as of July 2018 throws EINVAL
# if TCSAFLUSH is specified.
flags |= termios.TCSAFLUSH