Skip to content

Commit

Permalink
Auto merge of #7116 - alexcrichton:print-errs, r=Eh2406
Browse files Browse the repository at this point in the history
Don't suppress error messages with `-q`

If we're printing an error, make sure we always print it regardless of
verbosity settings!

Closes #7025
  • Loading branch information
bors committed Jul 10, 2019
2 parents bee0487 + bdb0ce8 commit 0bb6e14
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ impl Shell {

/// Prints a red 'error' message.
pub fn error<T: fmt::Display>(&mut self, message: T) -> CargoResult<()> {
self.print(&"error:", Some(&message), Red, false)
if self.needs_clear {
self.err_erase_line();
}
self.err.print(&"error:", Some(&message), Red, false)
}

/// Prints an amber 'warning' message.
Expand Down
36 changes: 36 additions & 0 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2137,3 +2137,39 @@ fn ws_warn_path() {
.with_stderr_contains("[WARNING] [..]/foo/a/Cargo.toml: the cargo feature `edition`[..]")
.run();
}

#[cargo_test]
fn invalid_missing() {
// Warnings include path to manifest.
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[dependencies]
x = { path = 'x' }
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build -q")
.with_status(101)
.with_stderr(
"\
error: [..]
Caused by:
[..]
Caused by:
[..]
Caused by:
[..]",
)
.run();
}

0 comments on commit 0bb6e14

Please sign in to comment.