|
|
@ -29,16 +29,14 @@ fn set_windows_creation_flags(cmd: &mut Command) {
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
#[cfg(windows)]
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
if !Path::new(&bin).exists() {
|
|
|
|
|
|
|
|
return None;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if env::args().any(|arg| arg == "--wsl") {
|
|
|
|
if env::args().any(|arg| arg == "--wsl") {
|
|
|
|
let mut cmd = Command::new("wsl");
|
|
|
|
let mut cmd = Command::new("wsl");
|
|
|
|
cmd.arg(bin);
|
|
|
|
cmd.arg(bin);
|
|
|
|
Some(cmd)
|
|
|
|
Some(cmd)
|
|
|
|
} else {
|
|
|
|
} else if Path::new(&bin).exists() {
|
|
|
|
Some(Command::new(bin))
|
|
|
|
Some(Command::new(bin))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -59,6 +57,23 @@ fn build_nvim_cmd() -> Command {
|
|
|
|
warn!("NEOVIM_BIN is invalid falling back to first bin in PATH");
|
|
|
|
warn!("NEOVIM_BIN is invalid falling back to first bin in PATH");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
|
|
|
|
if env::args().any(|arg| arg == "--wsl") {
|
|
|
|
|
|
|
|
if let Ok(output) = std::process::Command::new("wsl").arg("which").arg("nvim").output() {
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
|
|
|
|
|
|
let path = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
|
|
|
let mut cmd = Command::new("wsl");
|
|
|
|
|
|
|
|
cmd.arg(path.trim());
|
|
|
|
|
|
|
|
return cmd;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
error!("nvim not found in WSL path");
|
|
|
|
|
|
|
|
std::process::exit(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
error!("wsl which nvim failed");
|
|
|
|
|
|
|
|
std::process::exit(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if let Ok(path) = which::which("nvim") {
|
|
|
|
if let Ok(path) = which::which("nvim") {
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(path.to_str().unwrap()) {
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(path.to_str().unwrap()) {
|
|
|
|
cmd
|
|
|
|
cmd
|
|
|
@ -95,8 +110,13 @@ pub fn create_nvim_command() -> Command {
|
|
|
|
let mut cmd = build_nvim_cmd();
|
|
|
|
let mut cmd = build_nvim_cmd();
|
|
|
|
|
|
|
|
|
|
|
|
cmd.arg("--embed")
|
|
|
|
cmd.arg("--embed")
|
|
|
|
.args(SETTINGS.neovim_arguments.iter().skip(1))
|
|
|
|
.args(SETTINGS.neovim_arguments.iter().skip(1));
|
|
|
|
.stderr(Stdio::inherit());
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(debug_assertions))]
|
|
|
|
|
|
|
|
cmd.stderr(Stdio::piped());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(debug_assertions)]
|
|
|
|
|
|
|
|
cmd.stderr(Stdio::inherit());
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
#[cfg(windows)]
|
|
|
|
set_windows_creation_flags(&mut cmd);
|
|
|
|
set_windows_creation_flags(&mut cmd);
|
|
|
|