diff --git a/src/steps/generic.rs b/src/steps/generic.rs index bbddf6ed..7fe7798c 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -1,6 +1,6 @@ use crate::error::{Error, ErrorKind}; use crate::executor::{CommandExt, RunType}; -use crate::terminal::print_separator; +use crate::terminal::{print_separator, shell}; use crate::utils::{self, PathExt}; use directories::BaseDirs; use failure::ResultExt; @@ -110,7 +110,7 @@ pub fn run_myrepos_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), pub fn run_custom_command(name: &str, command: &str, run_type: RunType) -> Result<(), Error> { print_separator(name); - run_type.execute("sh").arg("-c").arg(command).check_run() + run_type.execute(shell()).arg("-c").arg(command).check_run() } pub fn run_composer_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { diff --git a/src/terminal.rs b/src/terminal.rs index d505a853..89566b3a 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -23,12 +23,12 @@ lazy_static! { } #[cfg(unix)] -fn shell() -> String { +pub fn shell() -> String { env::var("SHELL").unwrap_or_else(|_| "sh".to_string()) } #[cfg(windows)] -fn shell() -> &'static str { +pub fn shell() -> &'static str { which("pwsh").map(|_| "pwsh").unwrap_or("powershell") }