Use shell to spawn editor on Unix, so that they can accept parameters. Fix #245
This commit is contained in:
parent
7622daafd2
commit
cccf430671
16
src/edit.rs
16
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user