This commit is contained in:
sxyazi 2024-03-09 18:28:12 +08:00
parent 55c4aa580d
commit 31608862f8
No known key found for this signature in database

View file

@ -4,7 +4,7 @@ use anyhow::{bail, Result};
use imagesize::ImageSize; use imagesize::ImageSize;
use ratatui::layout::Rect; use ratatui::layout::Rect;
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}}; use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
use tracing::debug; use tracing::{debug, warn};
use yazi_config::PREVIEW; use yazi_config::PREVIEW;
use yazi_shared::RoCell; use yazi_shared::RoCell;
@ -71,14 +71,17 @@ impl Ueberzug {
} }
fn create_demon(adaptor: Adaptor) -> Result<Child> { fn create_demon(adaptor: Adaptor) -> Result<Child> {
Ok( let result = Command::new("ueberzug")
Command::new("ueberzug")
.args(["layer", "-so", &adaptor.to_string()]) .args(["layer", "-so", &adaptor.to_string()])
.kill_on_drop(true) .kill_on_drop(true)
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stderr(Stdio::null()) .stderr(Stdio::null())
.spawn()?, .spawn();
)
if let Err(ref e) = result {
warn!("ueberzug spawning failed: {}", e);
}
Ok(result?)
} }
fn adjust_rect(mut rect: Rect) -> Rect { fn adjust_rect(mut rect: Rect) -> Rect {