Send --help output to stdout
authorTom Tromey <tom@tromey.com>
Mon, 1 Jan 2018 22:33:01 +0000 (15:33 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 3 Jan 2018 20:51:33 +0000 (13:51 -0700)
Fixes #4878

src/cargo/lib.rs
tests/search.rs

index d68d8864a90c5ab88e709dd667944e99a4e9b910..6e8d771541c33e415dabe620e1d0a1f4f4dfe197 100755 (executable)
@@ -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 {
index 9410ce7e72da4a12af6378e4b8a7ff8f80637f24..028f7f52b7084f4392880c2ac624a8531893b7ee 100644 (file)
@@ -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 [..]"));
 }