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

print! will panic when No space left on device #82791

Closed
silence-coding opened this issue Mar 5, 2021 · 3 comments
Closed

print! will panic when No space left on device #82791

silence-coding opened this issue Mar 5, 2021 · 3 comments
Labels
C-bug Category: This is a bug.

Comments

@silence-coding
Copy link

The full log disk space is a possible problem during the running of the entire system. However, redirecting the output stream of the print to the log directory causes panic. In order to better locate the problem in the production environment, it is necessary to store the redirected content.

@silence-coding silence-coding added the C-bug Category: This is a bug. label Mar 5, 2021
@silence-coding
Copy link
Author

Redirection is used to print the panic stack (we do not want to introduce the third-party backtrace) and print possible output information in the third-party software.

@jyn514
Copy link
Member

jyn514 commented Mar 5, 2021

If you want to handle the error, you can use write! instead: https://doc.rust-lang.org/std/io/struct.Stdout.html#examples. println! is not meant to be used when you need error-handling.

@scottmcm
Copy link
Member

scottmcm commented Mar 6, 2021

It's documented behaviour that print! panics if writing to stdout fails: https://doc.rust-lang.org/std/macro.print.html#panics

As such, this would be a substantial change that needs an RFC, not just a bug: https://github.com/rust-lang/rfcs/blob/master/libs_changes.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants