Skip to content

Commit d4e0b71

Browse files
committed
Auto merge of #4884 - tromey:help-to-stdout, r=alexcrichton
Send --help output to stdout Fixes #4878
2 parents 28f89fd + 836e3ef commit d4e0b71

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/cargo/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! {
142142
} else if fatal {
143143
drop(shell.error(&error))
144144
} else {
145-
drop(writeln!(shell.err(), "{}", error))
145+
println!("{}", error);
146146
}
147147

148148
if !handle_cause(&error, shell) || hide {

tests/search.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,9 @@ fn help() {
277277
execs().with_status(0));
278278
assert_that(cargo_process("help").arg("search"),
279279
execs().with_status(0));
280+
// Ensure that help output goes to stdout, not stderr.
281+
assert_that(cargo_process("search").arg("--help"),
282+
execs().with_stderr(""));
283+
assert_that(cargo_process("search").arg("--help"),
284+
execs().with_stdout_contains("[..] --frozen [..]"));
280285
}

0 commit comments

Comments
 (0)