22 lines
416 B
Rust

use std::process::Command;
use super::shell::Shell;
pub fn shell_command(interactive: bool) -> Command {
let shell = Shell::from_env().unwrap_or_default();
let mut cmd = Command::new(shell.executable());
cmd.arg(match shell {
Shell::PowerShell => "-Command",
Shell::Cmd => "/C",
_ => "-c",
});
#[cfg(unix)]
if interactive {
cmd.arg("-i");
}
cmd
}