Include cmdline in error display; show cargo install progress
This commit is contained in:
parent
dd95f6f749
commit
93da201f07
|
@ -2345,6 +2345,7 @@ dependencies = [
|
|||
"camino",
|
||||
"once_cell",
|
||||
"walkdir",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -12,14 +12,14 @@ use snafu::Snafu;
|
|||
|
||||
#[derive(Debug, Snafu)]
|
||||
pub enum Error {
|
||||
#[snafu(display("Failed to execute: {cmdline}"))]
|
||||
DidNotExecute {
|
||||
cmdline: String,
|
||||
source: std::io::Error,
|
||||
},
|
||||
ReturnedError {
|
||||
cmdline: String,
|
||||
code: Option<i32>,
|
||||
},
|
||||
#[snafu(display("Fail with code {code:?}: {cmdline}"))]
|
||||
ReturnedError { cmdline: String, code: Option<i32> },
|
||||
#[snafu(display("Couldn't decode stdout/stderr as utf8"))]
|
||||
InvalidUtf8 {
|
||||
cmdline: String,
|
||||
source: FromUtf8Error,
|
||||
|
@ -110,13 +110,12 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_run() {
|
||||
assert!(matches!(
|
||||
Command::run(["fakefake", "1", "2"]),
|
||||
Err(Error::DidNotExecute {
|
||||
cmdline,
|
||||
..
|
||||
}) if cmdline == "fakefake 1 2"
|
||||
));
|
||||
assert_eq!(
|
||||
Command::run(["fakefake", "1", "2"])
|
||||
.unwrap_err()
|
||||
.to_string(),
|
||||
"Failed to execute: fakefake 1 2"
|
||||
);
|
||||
#[cfg(not(windows))]
|
||||
assert!(matches!(
|
||||
Command::new("false").ensure_success(),
|
||||
|
|
|
@ -15,3 +15,4 @@ anyhow = "1.0.71"
|
|||
camino = "1.1.4"
|
||||
once_cell = "1.17.1"
|
||||
walkdir = "2.3.3"
|
||||
which = "4.4.0"
|
||||
|
|
|
@ -198,13 +198,13 @@ impl LintContext {
|
|||
}
|
||||
|
||||
fn check_cargo_deny() -> Result<()> {
|
||||
Command::run(["cargo", "install", "-q", "cargo-deny@0.13.5"])?;
|
||||
Command::run(["cargo", "install", "cargo-deny@0.13.5"])?;
|
||||
Command::run(["cargo", "deny", "check", "-A", "duplicate"])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_hakari() -> Result<()> {
|
||||
Command::run(["cargo", "install", "-q", "cargo-hakari@0.9.23"])?;
|
||||
Command::run(["cargo", "install", "cargo-hakari@0.9.23"])?;
|
||||
Command::run(["cargo", "hakari", "generate"])?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -257,7 +257,9 @@ fn check_for_unstaged_changes() {
|
|||
}
|
||||
|
||||
fn generate_licences() -> Result<String> {
|
||||
Command::run(["cargo", "install", "-q", "cargo-license@0.5.1"])?;
|
||||
if which::which("cargo-license").is_err() {
|
||||
Command::run(["cargo", "install", "cargo-license@0.5.1"])?;
|
||||
}
|
||||
let output = Command::run_with_output([
|
||||
"cargo-license",
|
||||
"--features",
|
||||
|
|
Loading…
Reference in New Issue