bug #17177 [Process] Fix potential race condition leading to transient tests (nicolas-grekas)

This PR was merged into the 2.3 branch.

Discussion
----------

[Process] Fix potential race condition leading to transient tests

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15617
| License       | MIT
| Doc PR        | -

Sibling of #17176 on 2.3

Commits
-------

99fc428 [Process] Fix potential race condition leading to transient tests
This commit is contained in:
Nicolas Grekas 2015-12-30 11:25:59 +01:00
commit ddf11f5b8a

View File

@ -1072,13 +1072,10 @@ class Process
$callback = $this->callback;
foreach ($result as $type => $data) {
if (3 === $type) {
$this->fallbackStatus['running'] = false;
if (!isset($this->fallbackStatus['signaled'])) {
$this->fallbackStatus['exitcode'] = (int) $data;
}
} else {
if (3 !== $type) {
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
} elseif (!isset($this->fallbackStatus['signaled'])) {
$this->fallbackStatus['exitcode'] = (int) $data;
}
}
}