Commit ec9c1d57 authored by Mike Hibler's avatar Mike Hibler

Close all non stdin/stdout/stderr descriptors when running a command.

The xmlrpc logfile was getting left open in children and things were not
being properly background-ed as a result.
parent b8ea2c61
......@@ -5355,15 +5355,15 @@ def escapeshellarg(s):
def runcommand(cmd, separate_stderr=None):
from subprocess import *
if separate_stderr == True:
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=PIPE, shell=True)
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=PIPE, shell=True, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
return (p.returncode << 8, stdoutdata, stderrdata)
elif separate_stderr == False:
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=STDOUT, shell=True)
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=STDOUT, shell=True, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
return (p.returncode << 8, stdoutdata, stderrdata)
else:
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=STDOUT, shell=True)
p = Popen(cmd, stdin=None, stdout=PIPE, stderr=STDOUT, shell=True, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
return (p.returncode << 8, stdoutdata)
......
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