Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[System.Console] Behavior of piping into a bad/nonexistent program on Unix #15587

Closed
mellinoe opened this issue Oct 28, 2015 · 0 comments
Closed
Assignees
Milestone

Comments

@mellinoe
Copy link
Contributor

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):

Unhandled Exception: System.IO.IOException: Broken pipe
   at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter)
   at System.ConsolePal.Write(Int32 fd, Byte[] buffer, Int32 offset, Int32 count)
   at System.ConsolePal.UnixConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.SyncTextWriter.WriteLine(String value)
   at System.Console.WriteLine(String value)

I 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.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rtm milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants