fix: emit errors instead of warnings when glob patterns not found

This commit is contained in:
Weihang Lo 2020-10-10 09:50:36 +08:00
parent e5007de6e9
commit e4a1794b41
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
3 changed files with 5 additions and 12 deletions

View File

@ -158,8 +158,7 @@ impl Packages {
.map(PackageIdSpec::from_package_id);
specs.extend(matched_pkgs);
}
emit_pattern_not_found(ws, patterns, false)
.or_else(|e| ws.config().shell().warn(e))?;
emit_pattern_not_found(ws, patterns, false)?;
specs
}
Packages::Default => ws

View File

@ -3770,13 +3770,8 @@ fn build_virtual_manifest_glob_not_found() {
.build();
p.cargo("build -p bar -p '*z'")
.with_stderr(
"\
[WARNING] package pattern(s) `*z` not found in workspace [..]
[COMPILING] bar v0.1.0 ([..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
.with_status(101)
.with_stderr("[ERROR] package pattern(s) `*z` not found in workspace [..]")
.run();
}

View File

@ -3033,9 +3033,8 @@ fn test_virtual_manifest_glob_not_found() {
.build();
p.cargo("test -p bar -p '*z'")
.with_stderr_contains("[WARNING] package pattern(s) `*z` not found in workspace [..]")
.with_stdout_contains("running 1 test\ntest bar ... ok")
.with_stdout_does_not_contain("running 1 test\ntest baz ... ok")
.with_status(101)
.with_stderr("[ERROR] package pattern(s) `*z` not found in workspace [..]")
.run();
}