os.pipe and subprocess under Windows

Jeremy Sanders jeremy+complangpython at jeremysanders.net
Mon Nov 17 05:44:41 EST 2008


Lawrence D'Oliveiro wrote:

> <http://docs.python.org/library/subprocess.html>:
> 
>     If close_fds is true, all file descriptors except 0, 1 and 2 will be
>     closed before the child process is executed. (Unix only). Or, on
>     Windows, if close_fds is true then no handles will be inherited by the
>     child process.
> 
> Windows has no fork(2).

Yes - I saw that - thanks. This suggests that as I have used
closed_fds=False, then the child process will inherit the handles under
Windows, which it doesn't seem to. This documentation looks wrong to me.

I know Windows has no fork - that's why I used subprocess. This MSDN page
suggests you you need to do something with SetHandleInformation to get them
to be inherited. Doesn't subprocess do that?

http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx

-- 
Jeremy Sanders
http://www.jeremysanders.net/



More information about the Python-list mailing list