From 836e3efd38c0602202f756fe8f55096064849a2b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 1 Jan 2018 15:33:01 -0700 Subject: [PATCH] Send --help output to stdout Fixes #4878 --- src/cargo/lib.rs | 2 +- tests/search.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index d68d8864a..6e8d77154 100755 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -142,7 +142,7 @@ pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! { } else if fatal { drop(shell.error(&error)) } else { - drop(writeln!(shell.err(), "{}", error)) + println!("{}", error); } if !handle_cause(&error, shell) || hide { diff --git a/tests/search.rs b/tests/search.rs index 9410ce7e7..028f7f52b 100644 --- a/tests/search.rs +++ b/tests/search.rs @@ -277,4 +277,9 @@ fn help() { execs().with_status(0)); assert_that(cargo_process("help").arg("search"), execs().with_status(0)); + // Ensure that help output goes to stdout, not stderr. + assert_that(cargo_process("search").arg("--help"), + execs().with_stderr("")); + assert_that(cargo_process("search").arg("--help"), + execs().with_stdout_contains("[..] --frozen [..]")); } -- 2.39.5