mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 03:55:23 +00:00

- tv's default channel (when lauching `tv`) is now configurable via the `default_channel` configuration option - add `RUST_BACKTRACE=1` and `--nocapture` to ci testing for better debugging - remove all builtin channels and associated glue code as well as the `ToCliChannel` and `ToUnitChannel` derive macros - recode all builtin channels using shell commands (along with `fd`, `bat`, and `rg`) - add support for interactive shell commands inside cable channels - drop the `send_to_channel` feature until further notice (will be reimplemented later on in a more generic and customizable way)
30 lines
568 B
Rust
30 lines
568 B
Rust
use std::process::Command;
|
|
|
|
#[cfg(not(unix))]
|
|
use tracing::warn;
|
|
|
|
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");
|
|
}
|
|
|
|
#[cfg(not(unix))]
|
|
if interactive {
|
|
warn!("Interactive mode is not supported on Windows.");
|
|
}
|
|
|
|
cmd
|
|
}
|