diff --git a/Cargo.lock b/Cargo.lock index a1c0be8..21c7a6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3104,7 +3104,7 @@ dependencies = [ [[package]] name = "television" -version = "0.4.17" +version = "0.4.18" dependencies = [ "anyhow", "bat", @@ -3216,6 +3216,7 @@ dependencies = [ "lazy_static", "syntect", "tracing", + "winapi-util", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 497cf95..b9ff7be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "television" -version = "0.4.17" +version = "0.4.18" edition = "2021" description = "The revolution will be televised." license = "MIT" diff --git a/crates/television_utils/Cargo.toml b/crates/television_utils/Cargo.toml index a4b0f5d..ad34a36 100644 --- a/crates/television_utils/Cargo.toml +++ b/crates/television_utils/Cargo.toml @@ -24,3 +24,6 @@ bat = "0.24.0" directories = "5.0.1" syntect = "5.2.0" gag = "1.0.0" + +[target.'cfg(windows)'.dependencies] +winapi-util = "0.1.9" diff --git a/crates/television_utils/src/stdin.rs b/crates/television_utils/src/stdin.rs index e858439..afad91c 100644 --- a/crates/television_utils/src/stdin.rs +++ b/crates/television_utils/src/stdin.rs @@ -1,3 +1,6 @@ +#![allow(unused_imports)] +use tracing::debug; + /// Heuristic to determine if stdin is readable. /// /// This is used to determine if we should use the stdin channel. @@ -32,7 +35,7 @@ pub fn is_readable_stdin() -> bool { let typ = match winapi_util::file::typ(stdin) { Ok(typ) => typ, Err(err) => { - log::debug!( + debug!( "for heuristic stdin detection on Windows, \ could not get file type of stdin \ (thus assuming stdin is not readable): {err}", @@ -43,7 +46,7 @@ pub fn is_readable_stdin() -> bool { let is_disk = typ.is_disk(); let is_pipe = typ.is_pipe(); let is_readable = is_disk || is_pipe; - log::debug!( + debug!( "for heuristic stdin detection on Windows, \ found that is_disk={is_disk} and is_pipe={is_pipe}, \ and thus concluded that is_stdin_readable={is_readable}", @@ -53,7 +56,7 @@ pub fn is_readable_stdin() -> bool { #[cfg(not(any(unix, windows)))] fn imp() -> bool { - log::debug!("on non-{{Unix,Windows}}, assuming stdin is not readable"); + debug!("on non-{{Unix,Windows}}, assuming stdin is not readable"); false }