|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-08-03 19:04 UTC] felipe@php.net
[2009-08-03 19:05 UTC] svn@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 11:00:01 2025 UTC |
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