Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  [Process] Fix silencing `wait` when using a sigchild-enabled binary
  • Loading branch information
nicolas-grekas committed Aug 7, 2023
2 parents d62c23a + 45261e1 commit 0b5c291
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function start(callable $callback = null, array $env = [])

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

// Workaround for the bug, when PTS functionality is enabled.
// @see : https://bugs.php.net/69442
Expand Down
2 changes: 1 addition & 1 deletion Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ public function testWaitStoppedDeadProcess()
$process->wait();
$this->assertFalse($process->isRunning());

if ('\\' !== \DIRECTORY_SEPARATOR) {
if ('\\' !== \DIRECTORY_SEPARATOR && !\Closure::bind(fn () => $this->isSigchildEnabled(), $process, $process)()) {
$this->assertSame(0, $process->getExitCode());
}
}
Expand Down

0 comments on commit 0b5c291

Please sign in to comment.