-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected
all
Description
When running a process, with PTY=true, the output (STDOUT) is not well captured.
Sometimes, it does not work. It looks like the output is instead saved in STDERR
How to reproduce
<?php
require 'vendor/autoload.php';
use Symfony\Component\Process\Process;
$reference = run_process();
echo "Output Reference:\n";
echo $reference;
echo "\n";
for ($i=0; $i < 100_000; $i++) {
if ($i > 0 && $i % 80 === 0) {
echo "\n";
}
echo '.';
$output = run_process();
if ($output !== $reference) {
echo "\n!!Output changed!!\n";
echo "New output:\n";
echo "$output\n";
exit(1);
}
}
function run_process(){
$process = new Process(['cat', __FILE__]);
// If you comment the following line, the test become stable
$process->setPty(true);
$process->mustRun();
return $process->getOutput();
}
Possible Solution
No response
Additional Context
No response