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";