mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 12:05:34 +00:00
fix(windows): use cmd on windows instead of sh (#102)
Co-authored-by: liyixin <root@liyixin-test.sci-inv.cn>
This commit is contained in:
parent
4567f26a37
commit
f9d33e4797
@ -5,6 +5,7 @@ use television_fuzzy::{
|
||||
matcher::{config::Config, injector::Injector},
|
||||
Matcher,
|
||||
};
|
||||
use television_utils::command::shell_command;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Channel {
|
||||
@ -57,8 +58,7 @@ impl Channel {
|
||||
|
||||
#[allow(clippy::unused_async)]
|
||||
async fn load_candidates(command: String, injector: Injector<String>) {
|
||||
let output = std::process::Command::new("sh")
|
||||
.arg("-c")
|
||||
let output = shell_command()
|
||||
.arg(command)
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
|
@ -8,6 +8,7 @@ use std::collections::HashSet;
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
use std::sync::Arc;
|
||||
use television_channels::entry::{Entry, PreviewCommand};
|
||||
use television_utils::command::shell_command;
|
||||
use tracing::debug;
|
||||
|
||||
#[allow(dead_code)]
|
||||
@ -151,8 +152,7 @@ pub fn try_preview(
|
||||
let command = format_command(command, entry);
|
||||
debug!("Formatted preview command: {:?}", command);
|
||||
|
||||
let output = std::process::Command::new("sh")
|
||||
.arg("-c")
|
||||
let output = shell_command()
|
||||
.arg(&command)
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
|
19
crates/television-utils/src/command.rs
Normal file
19
crates/television-utils/src/command.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub fn shell_command() -> Command {
|
||||
let mut cmd = Command::new("sh");
|
||||
|
||||
cmd.arg("-c");
|
||||
|
||||
cmd
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn shell_command() -> Command {
|
||||
let mut cmd = Command::new("cmd");
|
||||
|
||||
cmd.arg("/c");
|
||||
|
||||
cmd
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
pub mod cache;
|
||||
pub mod command;
|
||||
pub mod files;
|
||||
pub mod indices;
|
||||
pub mod stdin;
|
||||
|
Loading…
x
Reference in New Issue
Block a user