Skip to content

Commit 87b7c93

Browse files
Merge branch '6.4' into 7.2
* 6.4: [VarExporter] Fix support for hooks and asymmetric visibility fix(process): use a pipe for stderr in pty mode to avoid mixed output between stdout and stderr [Cache] fix data collector
2 parents d8f411f + e2a61c1 commit 87b7c93

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Pipes/UnixPipes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getDescriptors(): array
7070
return [
7171
['pty'],
7272
['pty'],
73-
['pty'],
73+
['pipe', 'w'], // stderr needs to be in a pipe to correctly split error and output, since PHP will use the same stream for both
7474
];
7575
}
7676

Tests/ProcessTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,20 @@ public function testExitCodeTextIsNullWhenExitCodeIsNull()
559559
$this->assertNull($process->getExitCodeText());
560560
}
561561

562+
public function testStderrNotMixedWithStdout()
563+
{
564+
if (!Process::isPtySupported()) {
565+
$this->markTestSkipped('PTY is not supported on this operating system.');
566+
}
567+
568+
$process = $this->getProcess('echo "foo" && echo "bar" >&2');
569+
$process->setPty(true);
570+
$process->run();
571+
572+
$this->assertSame("foo\r\n", $process->getOutput());
573+
$this->assertSame("bar\n", $process->getErrorOutput());
574+
}
575+
562576
public function testPTYCommand()
563577
{
564578
if (!Process::isPtySupported()) {

0 commit comments

Comments
 (0)