Use interactive path for neovim resolution (#672)

* fix: use interactive env when getting nvim path

* fix: read interactive path in neovim
macos-click-through
Anirudh Balaji 4 years ago committed by GitHub
parent 0b976c3d28
commit 86a3ea650f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,7 +34,11 @@ fn set_windows_creation_flags(cmd: &mut Command) {
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> { fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
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.args(&[
bin.trim(),
"-c",
"let \\$PATH=system(\"bash -ic 'echo \\$PATH' 2>/dev/null\")",
]);
Some(cmd) Some(cmd)
} else if Path::new(&bin).exists() { } else if Path::new(&bin).exists() {
Some(Command::new(bin)) Some(Command::new(bin))
@ -63,14 +67,17 @@ fn build_nvim_cmd() -> Command {
#[cfg(windows)] #[cfg(windows)]
if env::args().any(|arg| arg == "--wsl") { if env::args().any(|arg| arg == "--wsl") {
if let Ok(output) = std::process::Command::new("wsl") if let Ok(output) = std::process::Command::new("wsl")
.arg("which") .args(&["bash", "-ic", "which nvim"])
.arg("nvim")
.output() .output()
{ {
if output.status.success() { if output.status.success() {
let path = String::from_utf8(output.stdout).unwrap(); let path = String::from_utf8(output.stdout).unwrap();
let mut cmd = Command::new("wsl"); let mut cmd = Command::new("wsl");
cmd.arg(path.trim()); cmd.args(&[
path.trim(),
"-c",
"let \\$PATH=system(\"bash -ic 'echo \\$PATH' 2>/dev/null\")",
]);
return cmd; return cmd;
} else { } else {
error!("nvim not found in WSL path"); error!("nvim not found in WSL path");

Loading…
Cancel
Save