Просмотр исходного кода

merged branch import/master (PR #1637)

Commits
-------

95ca258 Fixed problems with running processes returns wrong exitcode (-1) on Linux.

Discussion
----------

#1636

Fixed problems with running processes returns wrong exitcode (-1) on Linux.

---------------------------------------------------------------------------

by schmittjoh at 2011/07/11 11:07:42 -0700

This doesn't concern this PR specifically, but can we somehow start adding tests for this class? The process component seems like the by far most unstable code that we have.

---------------------------------------------------------------------------

by fabpot at 2011/07/11 23:07:43 -0700

@schmittjoh: Problem is that the behavior highly depends on the platform and PHP version.

---------------------------------------------------------------------------

by fabpot at 2011/07/11 23:14:23 -0700

@schmittjoh: By the way, we have added a bunch of tests recently (https://github.com/symfony/symfony/commit/2d29a82412702faf513710ce45f90346c4f08d27#tests/Symfony/Tests/Component/Process). Things are also "unstable" because the behavior depends on the amount of input, the amount of output, and when things happens. That means that it is also impossible to cover all possible cases reliably.
Fabien Potencier 14 лет назад
Родитель
Сommit
f2a301bc6c
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/Symfony/Component/Process/Process.php

+ 3 - 3
src/Symfony/Component/Process/Process.php

@@ -174,13 +174,13 @@ class Process
             $this->status = proc_get_status($process);
         }
 
-        proc_close($process);
+        $exitCode = proc_close($process);
 
         if ($this->status['signaled']) {
             throw new \RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->status['stopsig']));
         }
-
-        return $this->exitcode = $this->status['exitcode'];
+        
+        return $this->exitcode = ($this->status["running"] ? $exitCode : $this->status["exitcode"]);
     }
 
     /**