mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 03:55:23 +00:00
fix: add winapi-util
dependency for windows builds
This commit is contained in:
parent
df7020a7a8
commit
c70e675655
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -3104,7 +3104,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "television"
|
name = "television"
|
||||||
version = "0.4.17"
|
version = "0.4.18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bat",
|
"bat",
|
||||||
@ -3216,6 +3216,7 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"syntect",
|
"syntect",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "television"
|
name = "television"
|
||||||
version = "0.4.17"
|
version = "0.4.18"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "The revolution will be televised."
|
description = "The revolution will be televised."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -24,3 +24,6 @@ bat = "0.24.0"
|
|||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
syntect = "5.2.0"
|
syntect = "5.2.0"
|
||||||
gag = "1.0.0"
|
gag = "1.0.0"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winapi-util = "0.1.9"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#![allow(unused_imports)]
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
/// Heuristic to determine if stdin is readable.
|
/// Heuristic to determine if stdin is readable.
|
||||||
///
|
///
|
||||||
/// This is used to determine if we should use the stdin channel.
|
/// 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) {
|
let typ = match winapi_util::file::typ(stdin) {
|
||||||
Ok(typ) => typ,
|
Ok(typ) => typ,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::debug!(
|
debug!(
|
||||||
"for heuristic stdin detection on Windows, \
|
"for heuristic stdin detection on Windows, \
|
||||||
could not get file type of stdin \
|
could not get file type of stdin \
|
||||||
(thus assuming stdin is not readable): {err}",
|
(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_disk = typ.is_disk();
|
||||||
let is_pipe = typ.is_pipe();
|
let is_pipe = typ.is_pipe();
|
||||||
let is_readable = is_disk || is_pipe;
|
let is_readable = is_disk || is_pipe;
|
||||||
log::debug!(
|
debug!(
|
||||||
"for heuristic stdin detection on Windows, \
|
"for heuristic stdin detection on Windows, \
|
||||||
found that is_disk={is_disk} and is_pipe={is_pipe}, \
|
found that is_disk={is_disk} and is_pipe={is_pipe}, \
|
||||||
and thus concluded that is_stdin_readable={is_readable}",
|
and thus concluded that is_stdin_readable={is_readable}",
|
||||||
@ -53,7 +56,7 @@ pub fn is_readable_stdin() -> bool {
|
|||||||
|
|
||||||
#[cfg(not(any(unix, windows)))]
|
#[cfg(not(any(unix, windows)))]
|
||||||
fn imp() -> bool {
|
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
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user