{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/4219","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/4219/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/4219/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/4219/events","html_url":"https://github.com/dotnet/corefx/issues/4219","id":113946730,"number":4219,"title":"[System.Console] Behavior of piping into a bad/nonexistent program on Unix","user":{"login":"mellinoe","id":8918977,"avatar_url":"https://avatars.githubusercontent.com/u/8918977?v=3","gravatar_id":"","url":"https://api.github.com/users/mellinoe","html_url":"https://github.com/mellinoe","followers_url":"https://api.github.com/users/mellinoe/followers","following_url":"https://api.github.com/users/mellinoe/following{/other_user}","gists_url":"https://api.github.com/users/mellinoe/gists{/gist_id}","starred_url":"https://api.github.com/users/mellinoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mellinoe/subscriptions","organizations_url":"https://api.github.com/users/mellinoe/orgs","repos_url":"https://api.github.com/users/mellinoe/repos","events_url":"https://api.github.com/users/mellinoe/events{/privacy}","received_events_url":"https://api.github.com/users/mellinoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-28T23:22:05Z","updated_at":"2015-10-28T23:22:05Z","closed_at":null,"body":"Right now, if you try to pipe a program's output into a non-existent program on Unix, you will get an IOException on the first call to Console.Write(Line) (and probably other paths):\r\n\r\n````\r\nUnhandled Exception: System.IO.IOException: Broken pipe\r\n   at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter)\r\n   at System.ConsolePal.Write(Int32 fd, Byte[] buffer, Int32 offset, Int32 count)\r\n   at System.ConsolePal.UnixConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)\r\n   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)\r\n   at System.IO.SyncTextWriter.WriteLine(String value)\r\n   at System.Console.WriteLine(String value)\r\n````\r\n\r\nI chatted with Stephen briefly and we thought that it might be sensible to just ignore this particular exception (in Interop.CheckIO) and allow the program to continue. That is, if we are able to easily detect such a case, and are still able to correctly throw if some other error occurs. How do others feel about this? This seems to be in line with what other programs do if piped into a bad program."}}