close_fds
is supported on Windows (search for "close_fds" after that link) starting with Python 2.6 (if stdin
/stdout
/stderr
are not redirected). You might consider upgrading.
UPDATE 2017-11-16 after a down vote (why?): From the linked doc:
Note that on Windows, you cannot set close_fds to true and also
redirect the standard handles by setting stdin, stdout or stderr.
So you can either subprocess.call
with close_fds = True
and not setting stdin
, stdout
or stderr
(the default) (or setting them to None
):
subprocess.call(command, shell=True, close_fds = True)
or you subprocess.call
with close_fds = False
:
subprocess.call(command, shell=True, stderr=errptr, stdout=outptr, close_fds = False)
or (Python >= 3.2) you let subprocess.call
figure out the value of close_fds
by itself:
subprocess.call(command, shell=True, stderr=errptr, stdout=outptr)