ID:               49095
 Updated by:       fel...@php.net
 Reported By:      david dot gausmann at measx dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Program Execution
 Operating System: win32 only - Windows XP SP3
 PHP Version:      5.3.0
-Assigned To:      
+Assigned To:      felipe
 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2009-07-29 08:29:28] david dot gausmann at measx dot com

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 this bug report at http://bugs.php.net/?id=49095&edit=1

Reply via email to