mirror of
https://github.com/alexpasmantier/television.git
synced 2025-07-21 17:40:00 +00:00

Fixes #382 and #381 
22 lines
416 B
Rust
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
|
|
}
|