use std::path::Path;
use std::process::Command;
use console::style;
pub fn run(path: &Path, cmd: &str) {
let status = if cfg!(target_os = "windows") {
Command::new("cmd")
.args(["/C", cmd])
.current_dir(path)
.status()
} else {
Command::new("bash")
.args(["-lc", cmd])
.current_dir(path)
.status()
};
match status {
Ok(s) if !s.success() => {
eprintln!(
"{} command exited with non-zero status: {}",
style("warning:").yellow(),
s
);
}
Err(e) => {
eprintln!(
"{} failed to launch command: {}",
style("warning:").yellow(),
e
);
}
Ok(_) => {}
}
}