Skip to content

Commit

Permalink
build(deps): update windows-sys to v0.59.0 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspermeijn authored Sep 12, 2024
1 parent d51b42d commit fe7bc25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libc = "0.2"
hermit-abi = "0.4.0"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52.0"
version = "0.59.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ fn handle_is_console(handle: BorrowedHandle<'_>) -> bool {

let handle = handle.as_raw_handle();

unsafe {
// A null handle means the process has no console.
if handle.is_null() {
return false;
}
// A null handle means the process has no console.
if handle.is_null() {
return false;
}

unsafe {
let mut out = 0;
if GetConsoleMode(handle as HANDLE, &mut out) != 0 {
if GetConsoleMode(handle, &mut out) != 0 {
// False positives aren't possible. If we got a console then we definitely have a console.
return true;
}

// Otherwise, we fall back to an msys hack to see if we can detect the presence of a pty.
msys_tty_on(handle as HANDLE)
msys_tty_on(handle)
}
}

Expand Down Expand Up @@ -377,6 +377,6 @@ mod tests {
assert!(file_path.to_string_lossy().len() > MAX_PATH as usize);
let file = File::create(file_path).expect("Unable to create file");

assert!(!unsafe { crate::msys_tty_on(file.as_raw_handle() as isize) });
assert!(!unsafe { crate::msys_tty_on(file.as_raw_handle()) });
}
}

0 comments on commit fe7bc25

Please sign in to comment.