From: [EMAIL PROTECTED] Operating system: Debian GNU/Linux PHP version: 4.0CVS-2002-05-30 PHP Bug Type: Filesystem function related Bug description: proc_close() doesn't return exit value of process
proc_close() seems to always return -1, instead of the exit value of the process it closed. I feel that this a bug in proc_close(). If proc_close() is returning -1 because of some sort of error or problem, then the online manual (http://www.php.net/proc_close) needs to specify what conditions make proc_close return -1. Here's a script that reproduces the problem. Thanks :) <? /* costants to use with the $pipes array */ define(BASH_STDIN, 0); define(BASH_STDOUT, 1); /* a random exit code, just to keep things interesting */ $bashexit = rand(100, 199); /* a shell script to write to bash's STDIN */ $shellscript .= " echo I am bash, and I will return an exit code of $bashexit exit $bashexit "; /* run bash, with pipes to/from stdin and stdout */ $bash = proc_open( "bash", array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/tmp/bashstderr", "a") ), $pipes ); /* write the prepared shell script to bash's STDIN */ fwrite($pipes[BASH_STDIN], $shellscript); /* close pipe to bash's STDIN */ fclose($pipes[BASH_STDIN]); echo "bash's stdout:\n"; /* read and echo output from bash, one byte at a time */ while(!feof($pipes[BASH_STDOUT])) echo fread($pipes[BASH_STDOUT], 1); /* close pipe from bash's STDOUT */ fclose($pipes[BASH_STDOUT]); echo "\n"; $realexit = proc_close($bash); echo "bash's exit code: $realexit\n\n"; if ($realexit != $bashexit) echo "process exit code was $bashexit proc_close() returned $realexit!\n"; ?> -- Edit bug report at http://bugs.php.net/?id=17538&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17538&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17538&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17538&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17538&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17538&r=support Expected behavior: http://bugs.php.net/fix.php?id=17538&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17538&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17538&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17538&r=globals
