diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 16a33b4cc8..a7b2de2bfd 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -550,7 +550,7 @@ pub trait Backend: Debug + Send + Sync { .env(&*env::PATH_KEY, plugins::core::path_env_with_tv_path(tv)?) .env("MISE_TOOL_INSTALL_PATH", tv.install_path()) .with_pr(&ctx.pr) - .arg("-c") + .arg(env::SHELL_COMMAND_FLAG) .arg(script) .envs(self.exec_env(&ctx.config, &ctx.ts, tv).await?) .execute()?; diff --git a/src/cli/exec.rs b/src/cli/exec.rs index 1f0bd47eed..61a7ea2309 100644 --- a/src/cli/exec.rs +++ b/src/cli/exec.rs @@ -214,13 +214,10 @@ fn parse_command( let (program, args) = command.split_first().unwrap(); (program.clone(), args.into()) } - _ => { - #[cfg(unix)] - let command_flag = "-c"; - #[cfg(windows)] - let command_flag = "/c"; - (shell.into(), vec![command_flag.into(), c.clone().unwrap()]) - } + _ => ( + shell.into(), + vec![env::SHELL_COMMAND_FLAG.into(), c.clone().unwrap()], + ), } } diff --git a/src/env.rs b/src/env.rs index def96b906e..d625397560 100644 --- a/src/env.rs +++ b/src/env.rs @@ -31,6 +31,10 @@ pub static MISE_SHELL: Lazy> = Lazy::new(|| { .parse() .ok() }); +#[cfg(unix)] +pub static SHELL_COMMAND_FLAG: &str = "-c"; +#[cfg(windows)] +pub static SHELL_COMMAND_FLAG: &str = "/c"; // paths and directories #[cfg(test)]