Steps to reproduce
bash -c 'echo a; echo b >&2; echo c' 2>&1
On Windows, use cmd /c 'echo a & echo b >&2 & echo c' 2>&1.
Additionally, in Windows PowerShell, append | % tostring.
Note that it is the addition of 2>&1 that triggers the problem.
Expected behavior
That is, the output lines should be printed in the order written, across streams.
Actual behavior
Intermittently, the output order is unexpected in that the stderr output line is printed out of order; e.g.:
or
If you have trouble seeing the symptom, try something like the following
Unix:
while ($true) { if (($a = bash -c 'echo a; echo b >&2; echo c' 2>&1)[1] -notmatch 'b') { $a; break} }
Windows:
while ($true) { if (($a = cmd /c 'echo a & echo b >&2 & echo c' 2>&1 | % tostring)[1] -notmatch 'b') { $a; break} }
Environment data
PowerShell Core v6.0.0-beta.9 on macOS 10.13
PowerShell Core v6.0.0-beta.9 on Ubuntu 16.04.3 LTS
PowerShell Core v6.0.0-beta.9 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.674 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Steps to reproduce
On Windows, use
cmd /c 'echo a & echo b >&2 & echo c' 2>&1.Additionally, in Windows PowerShell, append
| % tostring.Note that it is the addition of
2>&1that triggers the problem.Expected behavior
That is, the output lines should be printed in the order written, across streams.
Actual behavior
Intermittently, the output order is unexpected in that the stderr output line is printed out of order; e.g.:
or
If you have trouble seeing the symptom, try something like the following
Unix:
Windows:
Environment data