just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli: show executable name in error message, include underlying error details

Since this is the error to spawn (or wait) process, command arguments aren't
important. Let's make that clear by not showing full command string.

#2614

+14 -7
+6 -5
cli/src/cli_util.rs
··· 2294 2294 .config() 2295 2295 .get("ui.editor") 2296 2296 .map_err(|err| CommandError::ConfigError(format!("ui.editor: {err}")))?; 2297 - let exit_status = editor 2298 - .to_command() 2299 - .arg(edit_path) 2300 - .status() 2301 - .map_err(|_| user_error(format!("Failed to run editor '{editor}'")))?; 2297 + let exit_status = editor.to_command().arg(edit_path).status().map_err(|err| { 2298 + user_error(format!( 2299 + "Failed to run editor '{name}': {err}", 2300 + name = editor.split_name(), 2301 + )) 2302 + })?; 2302 2303 if !exit_status.success() { 2303 2304 return Err(user_error(format!( 2304 2305 "Editor '{editor}' exited with an error"
+6
cli/src/config.rs
··· 447 447 } 448 448 449 449 impl CommandNameAndArgs { 450 + /// Returns command name without arguments. 451 + pub fn split_name(&self) -> Cow<str> { 452 + let (name, _) = self.split_name_and_args(); 453 + name 454 + } 455 + 450 456 /// Returns command name and arguments. 451 457 /// 452 458 /// The command name may be an empty string (as well as each argument.)
+2 -2
cli/src/ui.rs
··· 224 224 Err(e) => { 225 225 writeln!( 226 226 self.warning(), 227 - "Failed to spawn pager '{cmd}': {e}", 228 - cmd = self.pager_cmd, 227 + "Failed to spawn pager '{name}': {e}", 228 + name = self.pager_cmd.split_name(), 229 229 ) 230 230 .ok(); 231 231 }