Skip to content

Commit

Permalink
fix(windows): make exec work (#2598)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Sep 18, 2024
1 parent c2186ce commit ed5cc94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/cli/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,15 @@ fn parse_command(
(Some(command), _) => {
let (program, args) = command.split_first().unwrap();

(program.clone(), args.into())
if cfg!(windows) {
let args = vec!["/c".into(), program.into()]
.into_iter()
.chain(args.iter().cloned())
.collect();
(shell.into(), args)
} else {
(program.clone(), args.into())
}
}
_ => (shell.into(), vec!["-c".into(), c.clone().unwrap()]),
}
Expand Down
3 changes: 3 additions & 0 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ use crate::file::replace_path;
use crate::hook_env::{deserialize_watches, HookEnvWatches};

pub static ARGS: RwLock<Vec<String>> = RwLock::new(vec![]);
#[cfg(unix)]
pub static SHELL: Lazy<String> = Lazy::new(|| var("SHELL").unwrap_or_else(|_| "sh".into()));
#[cfg(windows)]
pub static SHELL: Lazy<String> = Lazy::new(|| var("COMSPEC").unwrap_or_else(|_| "cmd.exe".into()));

// paths and directories
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub static CORE_PLUGINS: Lazy<BackendMap> = Lazy::new(|| {
Arc::new(RubyPlugin::new()),
];
#[cfg(windows)]
let mut plugins: Vec<Arc<dyn Backend>> = vec![
let plugins: Vec<Arc<dyn Backend>> = vec![
// Arc::new(BunPlugin::new()),
// Arc::new(DenoPlugin::new()),
// Arc::new(ErlangPlugin::new()),
Expand Down

0 comments on commit ed5cc94

Please sign in to comment.