Commit 68ed6f14 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

testnode: spawn with close_fds=True in ProcessManager

As leaving close_fds=False can result in subtle bugs (see
http://zderadicka.eu/subtle-evil-of-close_fds-parameter-in-subprocess-popen/ )
close descriptors before launching anything with ProcessManager, especially
useful for starting things like supervisord.

/reviewed-on !841
parent 9d10f75b
...@@ -166,7 +166,8 @@ class ProcessManager(object): ...@@ -166,7 +166,8 @@ class ProcessManager(object):
logger.info('$ %s', command) logger.info('$ %s', command)
sys.stdout.flush() sys.stdout.flush()
p = subprocess.Popen(args, stdin=self.stdin, stdout=subprocess.PIPE, p = subprocess.Popen(args, stdin=self.stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env, **subprocess_kw) stderr=subprocess.PIPE, env=env, close_fds=True,
**subprocess_kw)
self.process_pid_set.add(p.pid) self.process_pid_set.add(p.pid)
timer = threading.Timer(self.max_timeout, timeoutExpired, args=(p,)) timer = threading.Timer(self.max_timeout, timeoutExpired, args=(p,))
self.timer_set.add(timer) self.timer_set.add(timer)
......
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