10000 bug #51296 [Process] Fix silencing `wait` when using a sigchild-enabl… · symfony/symfony@6d45e0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d45e0a

Browse files
bug #51296 [Process] Fix silencing wait when using a sigchild-enabled binary (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Process] Fix silencing `wait` when using a sigchild-enabled binary | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Not sure why it's not the case on the CI, but locally `testTermSignalTerminatesProcessCleanly` fails because `wait` outputs "Terminated". This fixes it. Commits ------- 3a31a93 [Process] Fix silencing `wait` when using a sigchild-enabled binary
2 parents c43dcc6 + 3a31a93 commit 6d45e0a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function start(callable $callback = null, array $env = [])
331331

332332
// See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
333333
$commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
334-
$commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
334+
$commandline .= 'pid=$!; echo $pid >&3; wait $pid 2>/dev/null; code=$?; echo $code >&3; exit $code';
335335

336336
// Workaround for the bug, when PTS functionality is enabled.
337337
// @see : https://bugs.php.net/69442

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ public function testWaitStoppedDeadProcess()
15241524
$process->wait();
15251525
$this->assertFalse($process->isRunning());
15261526

1527-
if ('\\' !== \DIRECTORY_SEPARATOR) {
1527+
if ('\\' !== \DIRECTORY_SEPARATOR && !\Closure::bind(function () { return $this->isSigchildEnabled(); }, $process, $process)()) {
15281528
$this->assertSame(0, $process->getExitCode());
15291529
}
15301530
}

0 commit comments

Comments
 (0)
0