Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): make exec work #2598

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading