-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Steps to reproduce
bash -c 'echo a; echo b >&2; echo c' 2>&1On 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
a
b
c
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.:
a
c
b
or
b
a
c
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)whut
Metadata
Metadata
Assignees
Labels
Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime