Commit 6940b230 authored by David Wilson's avatar David Wilson

issue #150: ansible: mark worker/child sock as CLOEXEC.

parent 7a394dc7
...@@ -61,11 +61,11 @@ class MuxProcess(object): ...@@ -61,11 +61,11 @@ class MuxProcess(object):
#: In the top-level process, this references one end of a socketpair(), #: In the top-level process, this references one end of a socketpair(),
#: which the MuxProcess blocks reading from in order to determine when #: 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. #: begin shutting itself down.
worker_sock = None 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`. #: :py:attr:`worker_sock`.
child_sock = None child_sock = None
...@@ -87,6 +87,9 @@ class MuxProcess(object): ...@@ -87,6 +87,9 @@ class MuxProcess(object):
cls.unix_listener_path = mitogen.unix.make_socket_path() cls.unix_listener_path = mitogen.unix.make_socket_path()
cls.worker_sock, cls.child_sock = socket.socketpair() 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() cls.child_pid = os.fork()
ansible_mitogen.logging.setup() ansible_mitogen.logging.setup()
if cls.child_pid: if cls.child_pid:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment