diff --git a/src/edit.rs b/src/edit.rs index 9290bfb..25d6377 100644 --- a/src/edit.rs +++ b/src/edit.rs @@ -43,9 +43,19 @@ pub fn open_editor(file_path: &Path) -> bool { }; // Start the editor and wait for its termination - let status = Command::new(&editor) - .arg(file_path) - .spawn(); + let status = if cfg!(target_os = "windows") { + Command::new(&editor) + .arg(file_path) + .spawn() + }else{ + // On Unix, spawn the editor using the shell so that it can + // accept parameters. See issue #245 + Command::new("/bin/bash") + .arg("-c") + .arg(format!("{} '{}'", editor, file_path.to_string_lossy())) + .spawn() + }; + if let Ok(mut child) = status { // Wait for the user to edit the configuration