sbt <shibt...@gmail.com> added the comment:

Although Windows fds are not inheritable, the handles associated with fds can 
be made inheritable.

A workaround for the fact fds are not inheritable is the following pattern:

1) The parent process converts the fd to a handle using _get_osfhandle(fd).

2) The parent process makes the handle inheritable (if it is not already) using 
SetHandleInformation() or DuplicateHandle().

3) The parent process starts the child process and passes the handle number on 
the commandline.

4) The child process gets the handle number by parsing the commandline.

5) The child process uses _open_osfhandle(handle, flags) to convert the handle 
into an fd.  

Note that Python has open_osfhandle() and get_osfhandle() in the msvcrt module. 
 In C, _open_osfhandle() and _get_osfhandle() are declared in io.h.

----------
nosy: +sbt

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12262>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to