Message284865
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. |
|
Date |
User |
Action |
Args |
2017-01-06 22:42:51 | vstinner | set | recipients:
+ vstinner, paul.moore, tim.golden, Bernt.Røskar.Brenna, sbt, zach.ware, eryksun, steve.dower, Segev Finer |
2017-01-06 22:42:51 | vstinner | set | messageid: <1483742571.33.0.186013652789.issue19764@psf.upfronthosting.co.za> |
2017-01-06 22:42:51 | vstinner | link | issue19764 messages |
2017-01-06 22:42:51 | vstinner | create | |
|