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

@@ -11,6 +11,7 @@ use std::process::Command;
use std::{env, fs};
use structopt::StructOpt;
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator, VariantNames};
use which_crate::which;
#[allow(unused_macros)]
macro_rules! str_value {
@@ -243,8 +244,11 @@ impl ConfigFile {
let config_path = Self::ensure(base_dirs)?;
let editor = editor();
debug!("Editing {} with {}", config_path.display(), editor);
Command::new(editor)
let command = which(&editor[0])?;
let args: Vec<&String> = editor.iter().skip(1).collect();
Command::new(command)
.args(args)
.arg(config_path)
.spawn()
.and_then(|mut p| p.wait())?;