Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update windows-sys to v0.59.0 #39

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()) });
}
}
Loading