-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo output could go to stderr #1473
Comments
cc #653, a possible solution to the problem proposed there. |
It does seem odd, though, to print informational output to stderr. Do other CLI tools have a habit of doing this? |
+1. I don't know about |
Having trouble thinking of tools that run a subcommand and also print informative output. A data point for a similar use Bazel always sends its informational output to stderr, for whether for A historical aside, |
+1 for not contaminating stdout during a 'cargo run' |
Why does it seem strange to print diagnostic information to stderr? I generally think of stderr as the default place to print things, only using stdout for things that are actually output. This way shell piping works as expected. Seeing as cargo output isn't supposed to be machine readable I would suggest putting all messages to stderr. This is especially useful when using |
This seems like a reasonable feature to me to add! Especially if it helps out running small scripts here and there so much. |
I've tried implementing this. Looks like the only code change is in this line. There are several calls to However when status messages go to stderr, 200+ of tests fail :( Should I just change |
Yeah I had a feeling that this'd need a lot of updates to tests... We'd probably just want to update them to use |
Will try to send a PR later today :) |
Changing the output stream to stderr broke integration with ALE. |
Luckily, ALE can handle stderr, stdout, or both streams at the same time. ALE will have to accept both streams, because it could be either one, depending on the version of cargo. |
Hm, the changed happened a rather long time ago, I would be surprised to find a lot of cargos which use stdout now.... |
Yeah, I noticed that. Strangely, I hadn't received any complaints until quite recently. That makes me wonder which versions of cargo people are actually using. |
Hm, maybe then complaints are about some unrelated change to Cargo/Rustc output? It would be prudent to ask about the version of Cargo indeed! |
Currently output generated by
cargo
itself goes to stdout, whilerustc
s goes to stderr. This is pretty annoying for a commandcargo run
, where the user controls stdout and may not appreciate the contamination fromcargo
, e.g.cargo run --bin foo > some_file.txt
will include theCompiling ...
andRunning ...
lines.Alteratively, I suppose we could support
cargo run --output some_file.txt --bin foo
which will do the redirect internally.The text was updated successfully, but these errors were encountered: