8000 merged branch romainneutron/process-merge-2.3 (PR #8990) · symfony/symfony@c59f52b · GitHub
[go: up one dir, main page]

Skip to content

Commit c59f52b

Browse files
committed
merged branch romainneutron/process-merge-2.3 (PR #8990)
This PR was merged into the 2.3 branch. Discussion ---------- [Process][2.3] Fix process merge in 2.3 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Handles should be read and closed after `proc_close` is called. (this follows merge of #8983) Commits ------- 19fef77 [Process] Fix process merge in 2.3
2 parents 7b2785b + 19fef77 commit c59f52b

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,6 @@ public function wait($callback = null)
303303
}
304304
$this->updateStatus(false);
305305

306-
while ($this->processPipes->hasOpenHandles()) {
307-
usleep(100);
308-
foreach ($this->processPipes->readAndCloseHandles(true) as $type => $data) {
309-
if (3 == $type) {
310-
$this->fallbackExitcode = (int) $data;
311-
} else {
312-
call_user_func($this->callback, $type === self::STDOUT ? self::OUT : self::ERR, $data);
313-
}
314-
}
315-
}
316-
$this->close();
317-
318306
if ($this->processInformation['signaled']) {
319307
if ($this->isSigchildEnabled()) {
320308
throw new RuntimeException('The process has been signaled.');
@@ -1062,13 +1050,24 @@ private function captureExitCode()
10621050
*/
10631051
private function close()
10641052
{
1065-
$this->processPipes->close();
10661053
$exitcode = -1;
10671054

10681055
if (is_resource($this->process)) {
10691056
$exitcode = proc_close($this->process);
10701057
}
10711058

1059+
while ($this->processPipes->hasOpenHandles()) {
1060+
usleep(100);
1061+
foreach ($this->processPipes->readAndCloseHandles(true) as $type => $data) {
1062+
if (3 == $type) {
1063+
$this->fallbackExitcode = (int) $data;
1064+
} else {
1065+
call_user_func($this->callback, $type === self::STDOUT ? self::OUT : self::ERR, $data);
1066+
}
1067+
}
1068+
}
1069+
$this->processPipes->close();
1070+
10721071
$this->exitcode = $this->exitcode !== null ? $this->exitcode : -1;
10731072
$this->exitcode = -1 != $exitcode ? $exitcode : $this->exitcode;
10741073

0 commit comments

Comments
 (0)
0