Re: Passing process handles to proc_open and co
| From: | Ángel González | Date: | Thu, 06 Dec 2012 14:51:47 +0000 |
| Subject: | Re: Passing process handles to proc_open and co | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64182@lists.php.net to get a copy of this message | ||
On 06/12/12 13:52, Pierre Joye wrote:
> hi,
>
> On Thu, Dec 6, 2012 at 12:40 PM, Ángel González <keisial@gmail.com> wrote:
>> On 06/12/12 09:49, Pierre Joye wrote:
>>> hi!
>>>
>>> While looking at the bug #63073, I was wondering if we could simply do
>>> not pass open handles to the newly created child process.
>> Looking at proc_open, where there is an explicit CreateProcess (we seem
>> to be using the library popen for the exec()...)
> We use CreateProcess too for our windows popen implementation, see:
>
> http://lxr.php.net/xref/PHP_5_4/TSRM/tsrm_win32.c#450
Oh, right. The filename confused me into thinking it was only used in ZTS.
Yes, the popen called will be that one.
>> If $pipes is empty and $descriptorspec doesn't require more than 0,1,2
>> then it should be safe not to set bInheritHandles.
>>
>> However, in other cases inheriting handles *will* be needed.
> hm, Why?
How else would you pass the child process the other side of a pipe ?
(It's possible that the handles passed in STARTUPINFO hStdInput,
hStdOutput and hStdError still get automatically inherited, msdn
doesn't document that point, but it would still be relevant for higher
descriptors)