This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients 3vi1, amaury.forgeotdarc, brian.curtin, sbt
Date 2011-06-04.19:31:02
SpamBayes Score 0.00017240878
Marked as misclassified No
Message-id <1307215863.92.0.44193118576.issue12262@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-06-04 19:31:04sbtsetrecipients: + sbt, amaury.forgeotdarc, brian.curtin, 3vi1
2011-06-04 19:31:03sbtsetmessageid: <1307215863.92.0.44193118576.issue12262@psf.upfronthosting.co.za>
2011-06-04 19:31:02sbtlinkissue12262 messages
2011-06-04 19:31:02sbtcreate