From 07f748475beacd41463ee5ebc0d7a93539ab8f55 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 17 Jun 2026 22:04:52 +0100 Subject: [PATCH] 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 Co-authored-by: Lorenz Leutgeb --- crates/radicle/src/cob/external.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/radicle/src/cob/external.rs b/crates/radicle/src/cob/external.rs index d16bcfdc..86d24749 100644 --- a/crates/radicle/src/cob/external.rs +++ b/crates/radicle/src/cob/external.rs @@ -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");