Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Process] Use a pipe for stderr in pty mode to avoid mixed output between stdout and stderr#59949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
OskarStark left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please add a test case or is it hard to achieve?
Was written in den PR header
Like i said, test is hard to achieve it happens randomly our reproducer for this is the current script : <?phprequire'vendor/autoload.php';useSymfony\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); }}functionrun_process(){$process =newProcess(['cat',__FILE__]);// If you comment the following line, the test become stable$process->setPty(true);$process->mustRun();return$process->getOutput();} |
f6b1b56
to001b418
CompareI spoke to soon, i added a test, before this change everything was in the |
… between stdout and stderr
001b418
toba755a8
CompareFailed test seems to not be related, so ready for review i guess |
Good catch, thanks@joelwurtz. |
bb07d18
intosymfony:6.4Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This PR split the stderr in a pipe to correctly split stdout / stderr when using
->setPty
When using
pty
for pipes, PHP will only open only one pty and share the "same" fd for all pipes (it use dup but the original fd is the same)Which means there is a possibility than stdout goes to stderr (or vice versa) when using
pty
for both stdout and stderr.I did not make a test as this behavior is erratic and happens under other conditions that are hard to find (see related issue to see reproducer, we have to do some iterations before it happens)