diff --git a/core/src/external/jq.rs b/core/src/external/jq.rs index aa0c0cd56..0ca626a48 100644 --- a/core/src/external/jq.rs +++ b/core/src/external/jq.rs @@ -29,6 +29,7 @@ pub async fn jq(path: &Path, skip: usize, limit: usize) -> Result 0 && i < skip + limit { Err(PeekError::Exceed(i.saturating_sub(limit))) } else { diff --git a/core/src/external/unar.rs b/core/src/external/unar.rs index 77270ba6c..94c50124e 100644 --- a/core/src/external/unar.rs +++ b/core/src/external/unar.rs @@ -1,7 +1,7 @@ use std::{path::Path, process::Stdio}; use anyhow::{bail, Result}; -use tokio::{io::{AsyncReadExt, BufReader}, process::Command}; +use tokio::{io::AsyncReadExt, process::Command}; pub async fn unar_head(path: &Path, target: &Path) -> Result> { let mut child = Command::new("unar") @@ -13,10 +13,8 @@ pub async fn unar_head(path: &Path, target: &Path) -> Result> { .spawn()?; let mut buf = vec![0; 1024]; - let mut reader = BufReader::new(child.stdout.take().unwrap()); - - reader.read(&mut buf).await.ok(); - child.kill().await.ok(); + child.stdout.take().unwrap().read(&mut buf).await.ok(); + child.start_kill().ok(); if buf.is_empty() { bail!("failed to get head of unar");