radicle/cob: Include command name on spawn fail
To improve the ability to work out what went wrong, should an external cob helper not be found, report the command name if the spawn fails. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org> Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>
This commit is contained in:
parent
88bf2a9648
commit
07f748475b
|
|
@ -114,6 +114,8 @@ pub enum Error {
|
|||
Op(#[from] OpEncodingError),
|
||||
#[error("serde_json: {0}")]
|
||||
Serde(#[from] JsonError),
|
||||
#[error("failed to spawn program '{program}': {source}")]
|
||||
Spawn { program: String, source: IoError },
|
||||
#[error("io: {0}")]
|
||||
Io(#[from] IoError),
|
||||
}
|
||||
|
|
@ -158,10 +160,14 @@ impl External {
|
|||
prefix + suffix
|
||||
};
|
||||
|
||||
let mut child = Command::new(command_name)
|
||||
let mut child = Command::new(&command_name)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
.spawn()
|
||||
.map_err(|source| Error::Spawn {
|
||||
program: command_name,
|
||||
source,
|
||||
})?;
|
||||
|
||||
let stdin = child.stdin.take().expect("handle preset");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue