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
|
// Start the editor and wait for its termination
|
||||||
let status = Command::new(&editor)
|
let status = if cfg!(target_os = "windows") {
|
||||||
.arg(file_path)
|
Command::new(&editor)
|
||||||
.spawn();
|
.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 {
|
if let Ok(mut child) = status {
|
||||||
// Wait for the user to edit the configuration
|
// Wait for the user to edit the configuration
|
||||||
|
|
Loading…
Reference in New Issue
Block a user