Merge pull request #2503 from Eijebong/winapi

Bump winapi to 0.3
This commit is contained in:
Nick Cameron 2018-03-03 11:39:24 +13:00 committed by GitHub
commit 7dba56f97b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

3
Cargo.lock generated
View File

@ -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]]

View File

@ -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" }

View File

@ -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
}
}