Fix config editing in Windows

This commit is contained in:
Roey Darwish Dror
2020-06-24 08:59:06 +03:00
parent 0a8b09b833
commit f27ec9cc18
2 changed files with 12 additions and 4 deletions

View File

@@ -92,8 +92,12 @@ pub fn sudo() -> Option<PathBuf> {
which("sudo").or_else(|| which("pkexec"))
}
pub fn editor() -> String {
env::var("EDITOR").unwrap_or_else(|_| String::from(if cfg!(windows) { "notepad" } else { "vi" }))
pub fn editor() -> Vec<String> {
env::var("EDITOR")
.unwrap_or_else(|_| String::from(if cfg!(windows) { "notepad" } else { "vi" }))
.split_whitespace()
.map(|s| s.to_owned())
.collect()
}
pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf> {