use std::{borrow::Cow, ffi::OsStr, path::PathBuf};
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Shell {
pub prog: PathBuf,
pub options: Vec<String>,
pub program_option: Option<Cow<'static, OsStr>>,
}
impl Shell {
pub fn new(name: impl Into<PathBuf>) -> Self {
Self {
prog: name.into(),
options: Vec::new(),
program_option: Some(Cow::Borrowed(OsStr::new("-c"))),
}
}
#[cfg(windows)]
#[must_use]
pub fn cmd() -> Self {
Self {
prog: "CMD.EXE".into(),
options: Vec::new(),
program_option: Some(Cow::Borrowed(OsStr::new("/C"))),
}
}
}