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

Don't panic when stdout doesn't exist #25977

Closed
alexcrichton opened this issue Jun 2, 2015 · 4 comments
Closed

Don't panic when stdout doesn't exist #25977

alexcrichton opened this issue Jun 2, 2015 · 4 comments
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

Tracking issue for rust-lang/rfcs#1014

@alexcrichton alexcrichton added B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 2, 2015
@remram44
Copy link
Contributor

remram44 commented Jun 9, 2015

See also #14505: compiler crashes on lost stdout (will probably be fixed when this is fixed)

sfackler added a commit to sfackler/rust that referenced this issue Jun 15, 2015
Closes rust-lang#25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
bors added a commit that referenced this issue Jun 15, 2015
Closes #25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
@remram44
Copy link
Contributor

It seems that, while closing the stdout descriptor and calling print!() won't panic anymore, writing to a broken pipe still panics:

$ ./test | false
thread '<main>' panicked at 'failed printing to stdout: Broken pipe (os error 32)', ../src/libstd/io/stdio.rs:585

It is not clear from the RFC (1014-stdout-existential-crisis.md) whether this was intended, but it might warrant clarification.

@alexcrichton
Copy link
Member Author

There was a little discussion on the RFC (in the collapsed comments), but it may not have made its way into the text.

@remram44
Copy link
Contributor

It seems that the behavior of stdout() (and even panic!()) was discussed at length but not print!(). It seems weird to have print!() work fine in daemons or after closing stdout, but not when the pipe gets closed... (looking into it, |head works (eg output gets silently discarded once head is done) and |false panics...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants