Skip to content

Commit

Permalink
When spawn() fails, include the underlying error in the message. (#613)
Browse files Browse the repository at this point in the history
Include spawn()'s error message when reporting a spawn error, as it may
contain information useful for determining the cause of the error.

This is motivated by the CI error messages in rust-lang/rust#87329.
  • Loading branch information
sunfishcode committed Aug 12, 2021
1 parent 4a6e8b7 commit 05a8062
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3041,9 +3041,12 @@ fn spawn(cmd: &mut Command, program: &str) -> Result<(Child, JoinHandle<()>), Er
&format!("Failed to find tool. Is `{}` installed?{}", program, extra),
))
}
Err(_) => Err(Error::new(
Err(ref e) => Err(Error::new(
ErrorKind::ToolExecError,
&format!("Command {:?} with args {:?} failed to start.", cmd, program),
&format!(
"Command {:?} with args {:?} failed to start: {:?}",
cmd, program, e
),
)),
}
}
Expand Down

0 comments on commit 05a8062

Please sign in to comment.