STINNER Victor added the comment:

Python already has a multiprocessing module which is able to pass handles 
(maybe also FD? I don't know) to child processes on Windows. I found some code 
in Lib/multiprocessing/reduction.py:
- duplicate()
- steal_handle()
- send_handle()

But the design doesn't really fit the subprocess module, since this design 
requires that the child process communicates with the parent process. On UNIX, 
fork()+exec() is used, so we can execute a few instructions after fork, which 
allows to pass an exception from the child to the parent. On Windows, 
CreateProcess() is used which doesn't allow directly to execute code before 
running the final child process.

The PEP 446 describes a solution using a wrapper process, so 
parent+wrapper+child, 3 processes. IMHO the best design for subprocess is 
really PROC_THREAD_ATTRIBUTE_HANDLE_LIST.

----------

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

Reply via email to