From 64f6372f3224f77a2ceb1eb9c0eefdcd3bfbe1e6 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Fri, 2 Mar 2018 15:20:26 +0100 Subject: [PATCH] Bump winapi to 0.3 --- Cargo.lock | 3 +-- Cargo.toml | 3 +-- src/utils.rs | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d954128544..488b2bb52a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,6 @@ dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -346,7 +345,7 @@ dependencies = [ "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 74542c565c3..dfaf38876db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,5 +58,4 @@ lazy_static = "1.0.0" libc = "0.2.11" [target.'cfg(windows)'.dependencies] -kernel32-sys = "0.2.2" -winapi = "0.2.7" +winapi = { version = "0.3" } diff --git a/src/utils.rs b/src/utils.rs index 20b30089d70..5ec5ee18009 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -382,13 +382,12 @@ pub fn isatty() -> bool { } #[cfg(windows)] pub fn isatty() -> bool { - extern crate kernel32; extern crate winapi; unsafe { - let handle = kernel32::GetStdHandle(winapi::winbase::STD_OUTPUT_HANDLE); + let handle = winapi::um::processenv::GetStdHandle(winapi::um::winbase::STD_OUTPUT_HANDLE); let mut out = 0; - kernel32::GetConsoleMode(handle, &mut out) != 0 + winapi::um::consoleapi::GetConsoleMode(handle, &mut out) != 0 } } -- 2.44.0