#49095 [NEW]: proc_get_status['exitcode'] fails on win32

From: Date: Wed, 29 Jul 2009 08:29:29 +0000
Subject: #49095 [NEW]: proc_get_status['exitcode'] fails on win32
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140419@lists.php.net to get a copy of this message
From: david dot gausmann at measx dot com Operating system: Windows XP SP3 PHP version: 5.3.0 PHP Bug Type: Program Execution Bug description: proc_get_status['exitcode'] fails on win32 Description: ------------ I watch an subprocess with proc_get_status and the returned exit code is never stored in the resulting array. But the exit code from proc_close works! Reproduce code: --------------- --- file1.php --- <?php $arPipes = array(); $rProcess = proc_open('""C:\php\php.exe" "C:\php\file2.php""', array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $arPipes); if($rProcess !== false) { $nExitCode = -1; do { while(!feof($arPipes[1])) { echo fread($arPipes[1], 1024); flush(); } $array = proc_get_status($rProcess); if(!$array) break; if(!$array['running'] && $array['exitcode'] != -1) $nExitCode = $array['exitcode']; } while($array['running']); fclose($arPipes[0]); fclose($arPipes[1]); fclose($arPipes[2]); $array = proc_get_status($rProcess); proc_close($rProcess); echo "ExitCode: ", $nExitCode; } ?> --- file2.php --- <?php echo "This is just a stupid script!\r\n"; exit(1); //Script failed! ?> Expected result: ---------------- This is just a stupid script! ExitCode: 1 Actual result: -------------- This is just a stupid script! ExitCode: -1 -- Edit bug report at http://bugs.php.net/?id=49095&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49095&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49095&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49095&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49095&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49095&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49095&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49095&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49095&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49095&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49095&r=support Expected behavior: http://bugs.php.net/fix.php?id=49095&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49095&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49095&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49095&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49095&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49095&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49095&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49095&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49095&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49095&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49095&r=mysqlcfg

« previous php.bugs (#140419) next »