···22942294 .config()
22952295 .get("ui.editor")
22962296 .map_err(|err| CommandError::ConfigError(format!("ui.editor: {err}")))?;
22972297- let exit_status = editor
22982298- .to_command()
22992299- .arg(edit_path)
23002300- .status()
23012301- .map_err(|_| user_error(format!("Failed to run editor '{editor}'")))?;
22972297+ let exit_status = editor.to_command().arg(edit_path).status().map_err(|err| {
22982298+ user_error(format!(
22992299+ "Failed to run editor '{name}': {err}",
23002300+ name = editor.split_name(),
23012301+ ))
23022302+ })?;
23022303 if !exit_status.success() {
23032304 return Err(user_error(format!(
23042305 "Editor '{editor}' exited with an error"
+6
cli/src/config.rs
···447447}
448448449449impl CommandNameAndArgs {
450450+ /// Returns command name without arguments.
451451+ pub fn split_name(&self) -> Cow<str> {
452452+ let (name, _) = self.split_name_and_args();
453453+ name
454454+ }
455455+450456 /// Returns command name and arguments.
451457 ///
452458 /// The command name may be an empty string (as well as each argument.)