Fix custom steps in Windows (fix #205)

This commit is contained in:
Roey Darwish Dror
2019-08-22 21:46:06 +03:00
parent d0245665ab
commit 2392a8bf9b
2 changed files with 4 additions and 4 deletions

View File

@@ -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> {

View File

@@ -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")
}