From 3787ef5bb901baed06274d96449a7b822e7dfe61 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 13 Apr 2002 11:13:02 +0000 Subject: [PATCH] amend proc_open example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78064 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/exec.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/exec.xml b/functions/exec.xml index c3a6847fa4..ab3fa85557 100644 --- a/functions/exec.xml +++ b/functions/exec.xml @@ -1,5 +1,5 @@ - + Program Execution functions Program Execution @@ -282,11 +282,14 @@ if (is_resource($process)) { // Any error output will be appended to /tmp/error-output.txt fwrite($pipes[0], ""); + fclose($pipes[0]); while(!feof($pipes[1])) { echo fgets($pipes[1], 1024); } - + fclose($pipes[1]); + // It is important that you close any pipes before calling + // proc_close in order to avoid a deadlock $return_value = proc_close($process); echo "command returned $return_value\n";