{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5424","repository_url":"https://api.github.com/repos/PowerShell/PowerShell","labels_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5424/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5424/comments","events_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5424/events","html_url":"https://github.com/PowerShell/PowerShell/issues/5424","id":273195201,"number":5424,"title":"Unpredictable ordering of native command output when merging the error stream into the success output stream","user":{"login":"mklement0","id":588825,"avatar_url":"https://avatars2.githubusercontent.com/u/588825?v=4","gravatar_id":"","url":"https://api.github.com/users/mklement0","html_url":"https://github.com/mklement0","followers_url":"https://api.github.com/users/mklement0/followers","following_url":"https://api.github.com/users/mklement0/following{/other_user}","gists_url":"https://api.github.com/users/mklement0/gists{/gist_id}","starred_url":"https://api.github.com/users/mklement0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklement0/subscriptions","organizations_url":"https://api.github.com/users/mklement0/orgs","repos_url":"https://api.github.com/users/mklement0/repos","events_url":"https://api.github.com/users/mklement0/events{/privacy}","received_events_url":"https://api.github.com/users/mklement0/received_events","type":"User","site_admin":false},"labels":[{"id":401720735,"url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Area-Engine","name":"Area-Engine","color":"5319e7","default":false},{"id":423531321,"url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Resolution-Answered","name":"Resolution-Answered","color":"ffffff","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-11-12T03:11:47Z","updated_at":"2018-02-12T04:44:18Z","closed_at":"2018-02-10T00:20:51Z","author_association":"CONTRIBUTOR","body":"Steps to reproduce\r\n------------------\r\n\r\n```powershell\r\nbash -c 'echo a; echo b >&2; echo c' 2>&1\r\n```\r\n\r\nOn Windows, use `cmd /c 'echo a & echo b >&2 & echo c' 2>&1`.\r\nAdditionally, in _Windows PowerShell_, append `| % tostring`.\r\n\r\nNote that it is the addition of `2>&1` that triggers the problem.\r\n\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\na\r\nb\r\nc\r\n```\r\nThat is, the output lines should be printed in the order written, across streams.\r\n\r\nActual behavior\r\n---------------\r\n\r\n_Intermittently_, the output order is unexpected in that the stderr output line is printed out of order; e.g.:\r\n\r\n```none\r\na\r\nc\r\nb\r\n```\r\n\r\nor \r\n\r\n```none\r\nb\r\na\r\nc\r\n```\r\n\r\nIf you have trouble seeing the symptom, try something like the following\r\n\r\nUnix:\r\n\r\n```powershell\r\nwhile ($true) { if (($a = bash -c 'echo a; echo b >&2; echo c' 2>&1)[1] -notmatch 'b') { $a; break} }\r\n```\r\n\r\nWindows:\r\n\r\n```powershell\r\nwhile ($true) { if (($a = cmd /c 'echo a & echo b >&2 & echo c' 2>&1 | % tostring)[1] -notmatch 'b') { $a; break}  }\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\r\n```powershell\r\nPowerShell Core v6.0.0-beta.9 on macOS 10.13\r\nPowerShell Core v6.0.0-beta.9 on Ubuntu 16.04.3 LTS\r\nPowerShell Core v6.0.0-beta.9 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)\r\nWindows PowerShell v5.1.15063.674 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/comments/364828216","html_url":"https://github.com/PowerShell/PowerShell/issues/5424#issuecomment-364828216","issue_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5424","id":364828216,"user":{"login":"iSazonov","id":22290914,"avatar_url":"https://avatars2.githubusercontent.com/u/22290914?v=4","gravatar_id":"","url":"https://api.github.com/users/iSazonov","html_url":"https://github.com/iSazonov","followers_url":"https://api.github.com/users/iSazonov/followers","following_url":"https://api.github.com/users/iSazonov/following{/other_user}","gists_url":"https://api.github.com/users/iSazonov/gists{/gist_id}","starred_url":"https://api.github.com/users/iSazonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iSazonov/subscriptions","organizations_url":"https://api.github.com/users/iSazonov/orgs","repos_url":"https://api.github.com/users/iSazonov/repos","events_url":"https://api.github.com/users/iSazonov/events{/privacy}","received_events_url":"https://api.github.com/users/iSazonov/received_events","type":"User","site_admin":false},"created_at":"2018-02-12T04:44:18Z","updated_at":"2018-02-12T04:44:18Z","author_association":"COLLABORATOR","body":"I have to remind #2450"}}
{"actor":{"display_login":"iSazonov"}}