Skip to content

Commit

Permalink
fix: add winapi-util dependency for windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpasmantier committed Nov 10, 2024
1 parent df7020a commit c70e675
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 3 additions & 0 deletions crates/television_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 6 additions & 3 deletions crates/television_utils/src/stdin.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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}",
Expand All @@ -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}",
Expand All @@ -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
}

Expand Down

0 comments on commit c70e675

Please sign in to comment.