mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-08 04:25:23 +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::{config::Config, injector::Injector},
|
||||||
Matcher,
|
Matcher,
|
||||||
};
|
};
|
||||||
|
use television_utils::command::shell_command;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct Channel {
|
pub struct Channel {
|
||||||
@ -57,8 +58,7 @@ impl Channel {
|
|||||||
|
|
||||||
#[allow(clippy::unused_async)]
|
#[allow(clippy::unused_async)]
|
||||||
async fn load_candidates(command: String, injector: Injector<String>) {
|
async fn load_candidates(command: String, injector: Injector<String>) {
|
||||||
let output = std::process::Command::new("sh")
|
let output = shell_command()
|
||||||
.arg("-c")
|
|
||||||
.arg(command)
|
.arg(command)
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute process");
|
.expect("failed to execute process");
|
||||||
|
@ -8,6 +8,7 @@ use std::collections::HashSet;
|
|||||||
use std::sync::atomic::{AtomicU8, Ordering};
|
use std::sync::atomic::{AtomicU8, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use television_channels::entry::{Entry, PreviewCommand};
|
use television_channels::entry::{Entry, PreviewCommand};
|
||||||
|
use television_utils::command::shell_command;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -151,8 +152,7 @@ pub fn try_preview(
|
|||||||
let command = format_command(command, entry);
|
let command = format_command(command, entry);
|
||||||
debug!("Formatted preview command: {:?}", command);
|
debug!("Formatted preview command: {:?}", command);
|
||||||
|
|
||||||
let output = std::process::Command::new("sh")
|
let output = shell_command()
|
||||||
.arg("-c")
|
|
||||||
.arg(&command)
|
.arg(&command)
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute process");
|
.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 cache;
|
||||||
|
pub mod command;
|
||||||
pub mod files;
|
pub mod files;
|
||||||
pub mod indices;
|
pub mod indices;
|
||||||
pub mod stdin;
|
pub mod stdin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user