diff --git a/Cargo.lock b/Cargo.lock index 4b1adebb..374ae3c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,12 +132,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - [[package]] name = "fastrand" version = "1.7.0" @@ -170,7 +164,6 @@ dependencies = [ "simplelog", "tokio", "walkdir", - "which", ] [[package]] @@ -1103,17 +1096,6 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" -[[package]] -name = "which" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" -dependencies = [ - "either", - "lazy_static", - "libc", -] - [[package]] name = "winapi" version = "0.2.8" diff --git a/Cargo.toml b/Cargo.toml index 40be7f5a..df757c7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ shlex = "1.1" simplelog = { version = "^0.11.2", features = ["paris"] } tokio = { version = "1.16.1", features = ["rt-multi-thread"] } walkdir = "2" -which = "4.2.5" [target.x86_64-unknown-linux-musl.dependencies] openssl = { version = "0.10", features = ["vendored"] } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 54259b3e..ca93036c 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -14,7 +14,6 @@ use std::{ use regex::Regex; use simplelog::*; -use which::which; mod arg_parse; mod config; @@ -350,9 +349,15 @@ pub async fn stderr_reader(std_errors: ChildStderr, suffix: String) -> Result<() } fn is_in_system(name: &str) { - // Check whether name is on PATH and marked as executable - - if which(name).is_err() { + if let Ok(mut proc) = Command::new(name) + .stderr(Stdio::null()) + .stdout(Stdio::null()) + .spawn() + { + if let Err(e) = proc.wait() { + error!("{:?}", e) + }; + } else { error!("{} not found on system!", name); exit(0x0100); } @@ -403,6 +408,10 @@ fn ffmpeg_libs_and_filter() -> (Vec, Vec) { } } + if let Err(e) = ff_proc.wait() { + error!("{:?}", e) + }; + (libs, filters) } pub fn validate_ffmpeg() {