-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Stderr #5641
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
Comments
@SephVelut I don't quite understand what problem exactly are you trying to solve? Could you rephrase your question? The current strategy for output in Cargo is that all human-reaadble things go to stderr, and all machine readable things go to stdout. That way, you can safely parse Cargo's stdout without accounting for various diagnostic messages. |
Shouldn't all output go to stdout and reserve stderr for errors in executing the command? Most command line programs expect this. Stderr and stdout can both be piped down at the same time to other commands and stderr can be treated like a failure case. Not of the program but of the command. There's a distinction. Cargo failing to build, for example, is not an error. Undefined arguments to the command are. I don't think there is a distinction between machine readable and human readable. Unless it's literally binary, that's subjective :) And shouldn't parsing Cargo's output be the responsibility of the user, using other commands? Like awk or sed. |
This is currently an intentional design decision where you can execute commands like |
Why not just wait for the OP to respond/close? What's the hurry? I don't understand the reason for the design decision, can you please explain a little more? Wouldn't it be weird if a function that returned |
The design decision here is for all information output of Cargo to go to one stream, stderr. Sort of how all compiler error messages go to stderr as well. The thinking is then that stdout is reserved for programs Cargo runs, so Cargo never produces meaningful output on stdout. That way you can throw away stderr from Cargo or only capture stdout and you're guaranteed to get your program's output |
…utput to stderr, which leads to it being colored in red in build log. See rust-lang/cargo#5641 for more info
Uh oh!
There was an error while loading. Please reload this page.
I don't get the justification #1473 for switching stdout with stderr. If you want special formatting from stdout then its on you to sed or awk.
From an abstract perspective they are both just file descriptors, but there is no reason to trickle down a formatting use case to how stderr and stdout are conventionally treated by everyone else. That is, write to stderr if the command exited with a code other than 0.
The text was updated successfully, but these errors were encountered: