From ae8ba24f59ccb643e860f4f986e3f2d9d2301520 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 21 Feb 2019 04:15:16 +0000 Subject: [PATCH 1/4] service: make service list optional. Used by the new work. --- mitogen/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mitogen/service.py b/mitogen/service.py index dc200b95..302e81ab 100644 --- a/mitogen/service.py +++ b/mitogen/service.py @@ -451,7 +451,7 @@ class Pool(object): """ activator_class = Activator - def __init__(self, router, services, size=1, overwrite=False): + def __init__(self, router, services=(), size=1, overwrite=False): self.router = router self._activator = self.activator_class() self._ipc_latch = mitogen.core.Latch() From 0b177f14916fbed9f9e714074c49375645be3756 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 22 Feb 2019 00:48:56 +0000 Subject: [PATCH 2/4] docs: update Changelog. --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7f9b23a5..ea52ef29 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -176,7 +176,8 @@ Thanks! Mitogen would not be possible without the support of users. A huge thanks for bug reports, testing, features and fixes in this release contributed by -`Fabian Arrotin `_, and +`Fabian Arrotin `_, +`Percy Grunwald `_, `Petr Enkov `_, and `@elbunda `_. From 87c8ab432391335e72d7146d59d3252471ce91c4 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 23 Feb 2019 15:52:52 +0000 Subject: [PATCH 3/4] issue #550: fix up TTY ioctls on WSL 2016 Anniversary Update --- mitogen/core.py | 9 ++++++++- mitogen/parent.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 607c4bfb..578337f7 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -140,7 +140,6 @@ try: except NameError: BaseException = Exception -IS_WSL = 'Microsoft' in os.uname()[2] PY24 = sys.version_info < (2, 5) PY3 = sys.version_info > (3,) if PY3: @@ -164,6 +163,14 @@ try: except NameError: next = lambda it: it.next() +# #550: prehistoric WSL did not advertise itself in uname output. +try: + fp = open('/proc/sys/kernel/osrelease') + IS_WSL = 'Microsoft' in fp.read() + fp.close() +except IOError: + IS_WSL = False + #: Default size for calls to :meth:`Side.read` or :meth:`Side.write`, and the #: size of buffers configured by :func:`mitogen.parent.create_socketpair`. This diff --git a/mitogen/parent.py b/mitogen/parent.py index f25bd6c2..a05bcbef 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -371,11 +371,11 @@ def create_child(args, merge_stdio=False, stderr_pipe=False, preexec_fn=None): def _acquire_controlling_tty(): os.setsid() - if sys.platform == 'linux2': + if sys.platform in ('linux', 'linux2'): # On Linux, the controlling tty becomes the first tty opened by a # process lacking any prior tty. os.close(os.open(os.ttyname(2), os.O_RDWR)) - if hasattr(termios, 'TIOCSCTTY'): + if hasattr(termios, 'TIOCSCTTY') and not mitogen.core.IS_WSL: # On BSD an explicit ioctl is required. For some inexplicable reason, # Python 2.6 on Travis also requires it. fcntl.ioctl(2, termios.TIOCSCTTY) From bd4d55dc9078ee5a3ade376aeb50578e2071a909 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 23 Feb 2019 15:53:59 +0000 Subject: [PATCH 4/4] issue #550: parent: add explanatory comment. --- mitogen/parent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mitogen/parent.py b/mitogen/parent.py index a05bcbef..3d02bc43 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -376,6 +376,7 @@ def _acquire_controlling_tty(): # process lacking any prior tty. os.close(os.open(os.ttyname(2), os.O_RDWR)) if hasattr(termios, 'TIOCSCTTY') and not mitogen.core.IS_WSL: + # #550: prehistoric WSL does not like TIOCSCTTY. # On BSD an explicit ioctl is required. For some inexplicable reason, # Python 2.6 on Travis also requires it. fcntl.ioctl(2, termios.TIOCSCTTY)