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

"cargo help test" output should go to stdout #4878

Closed
tromey opened this issue Dec 30, 2017 · 8 comments · Fixed by #4884
Closed

"cargo help test" output should go to stdout #4878

tromey opened this issue Dec 30, 2017 · 8 comments · Fixed by #4884
Labels
C-bug Category: bug

Comments

@tromey
Copy link
Contributor

tromey commented Dec 30, 2017

Currently, cargo help test output goes to stderr. This makes it unnecessarily difficult to pipe the output through a pager. Furthermore, this isn't an error situation -- the command exists to print the help, so it seems to me that it ought to go to stdout. (If it's any use, this is a longstanding GNU convention for tools as well; so many if not most core Linux utilities work this way.)

@alexcrichton alexcrichton added the C-bug Category: bug label Dec 30, 2017
@alexcrichton
Copy link
Member

Definitely sounds like a bug!

@tromey
Copy link
Contributor Author

tromey commented Dec 30, 2017

Perhaps the cause is actually in docopt.

@tromey
Copy link
Contributor Author

tromey commented Dec 30, 2017

No, docopt seems to do this properly at first read.

@tromey
Copy link
Contributor Author

tromey commented Dec 30, 2017

Changing exit_with_error to print to stdout in the non-fatal case worked for me, but I wonder if this needs a test.

@matklad
Copy link
Member

matklad commented Jan 1, 2018

Furthermore, this isn't an error situation

To give some historical context, we use stderr in Cargo not only for errors, but for all "human" content, so that tools can safely parse stdout as JSON.

This definitely should not apply to cargo --help though!

@tromey
Copy link
Contributor Author

tromey commented Jan 1, 2018

I added a test to tests/search.rs but I can't tell from cargo test whether or not it is actually running. I guess I can try hacking in a println and see if that does anything.

@tromey
Copy link
Contributor Author

tromey commented Jan 1, 2018

Yeah, that doesn't seem to run.

@tromey
Copy link
Contributor Author

tromey commented Jan 1, 2018

Aha, I figured out how to run it by hand.

tromey added a commit to tromey/cargo that referenced this issue Jan 1, 2018
bors added a commit that referenced this issue Jan 2, 2018
Send --help output to stdout

Fixes #4878
tromey added a commit to tromey/cargo that referenced this issue Jan 3, 2018
bors added a commit that referenced this issue Jan 3, 2018
@bors bors closed this as completed in #4884 Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants