Skip to content

Commit

Permalink
Merge branch 'windows-path-resolve'
Browse files Browse the repository at this point in the history
  • Loading branch information
blahgeek committed Apr 17, 2024
2 parents 5098d78 + c5034e2 commit 678641d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
42 changes: 38 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env_logger = "0.10"
log = "0.4.20"
clap = { version = "4.4", features = ["derive", "cargo"] }
clap-verbosity-flag = "2.1.1"
which = "6.0.1"

[[example]]
name = "native-json-parser"
Expand Down
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::{Result, bail};
use log::trace;
use clap::Parser;

use emacs_lsp_booster::app;
Expand Down Expand Up @@ -61,7 +62,15 @@ fn main() -> Result<()> {
std::process::exit(1);
}));

let mut cmd = std::process::Command::new(&cli.server_cmd[0]);
// In windows, Command::new cannot find .cmd files, so use `which` to do that
// https://github.com/rust-lang/rust/issues/37519
let server_cmd_prog = if cfg!(windows) {
which::which(&cli.server_cmd[0])?
} else {
std::path::PathBuf::from(&cli.server_cmd[0])
};
trace!("Using server prog: {:?}", server_cmd_prog);
let mut cmd = std::process::Command::new(&server_cmd_prog);
cmd.args(&cli.server_cmd[1..]);

let exit_status = app::run_app_forever(std::io::stdin(), std::io::stdout(), cmd, app::AppOptions {
Expand Down

0 comments on commit 678641d

Please sign in to comment.