From 6940b230133b820406882e6c5669b481c654c707 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 17 Mar 2018 21:18:56 +0545 Subject: [PATCH] issue #150: ansible: mark worker/child sock as CLOEXEC. --- ansible_mitogen/process.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py index 7cb08892..c9247fda 100644 --- a/ansible_mitogen/process.py +++ b/ansible_mitogen/process.py @@ -61,11 +61,11 @@ class MuxProcess(object): #: In the top-level process, this references one end of a socketpair(), #: which the MuxProcess blocks reading from in order to determine when - #: the master process deies. Once the read returns, the MuxProcess will + #: the master process dies. Once the read returns, the MuxProcess will #: begin shutting itself down. worker_sock = None - #: In the worker process, this references the other end of the + #: In the worker process, this references the other end of #: :py:attr:`worker_sock`. child_sock = None @@ -87,6 +87,9 @@ class MuxProcess(object): cls.unix_listener_path = mitogen.unix.make_socket_path() cls.worker_sock, cls.child_sock = socket.socketpair() + mitogen.core.set_cloexec(cls.worker_sock) + mitogen.core.set_cloexec(cls.child_sock) + cls.child_pid = os.fork() ansible_mitogen.logging.setup() if cls.child_pid: