Hi Andi,

Here is yet another patch to tsrm.  The popen implementation was
broken.  You could not write to a process because pclose did not wait
for a process to end, and the executed process could hang, because both
sides of the pipe were inheritable.

Index: tsrm_win32.c
===================================================================
RCS file: /repository/TSRM/tsrm_win32.c,v
retrieving revision 1.4
diff -r1.4 tsrm_win32.c
98a99,106
> static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
>       HANDLE copy, self = GetCurrentProcess();
>       if (!DuplicateHandle(self, fh, self, &copy, 0, inherit, 
>DUPLICATE_SAME_ACCESS|DUPLICATE_CLOSE_SOURCE)) {
>               return NULL;
>       }
>       return copy;
> }
> 
129c137,138
< 
---
>       /* you cannot allow the php end of the pipe to be inheritable, as that will
>          cause handles to be leaked, and may cause a spawned process to get stuck! */
130a140
>               in = dupHandle(in, FALSE);
133a144
>               out = dupHandle(out, FALSE);
173a185,189
> 
>       /* pclose is supposed to wait for the process to finish 
>          This should probabaly be configurable to avoid lockups
>       */
>       WaitForSingleObject(process->prochnd, INFINITE);

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to