Skip to content

Commit 3214ec2

Browse files
authored
Support both windows-sys 0.52 and 0.59. (#42)
* Support both windows-sys 0.52 and 0.59. * Uhdate the wasm32-wasi target.
1 parent fe7bc25 commit 3214ec2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ jobs:
7171
toolchain: ${{ matrix.rust }}
7272
- run: >
7373
rustup target add
74-
wasm32-wasi
75-
- run: cargo check --workspace --release -vv --target=wasm32-wasi --all-targets
74+
wasm32-wasip2
75+
- run: cargo check --workspace --release -vv --target=wasm32-wasip2 --all-targets
7676

7777
test:
7878
name: Test

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ libc = "0.2"
2222
hermit-abi = "0.4.0"
2323

2424
[target.'cfg(windows)'.dependencies.windows-sys]
25-
version = "0.59.0"
25+
version = ">=0.52, <=0.59"
2626
features = [
2727
"Win32_Foundation",
2828
"Win32_Storage_FileSystem",
@@ -33,7 +33,7 @@ features = [
3333
atty = "0.2.14"
3434

3535
[target.'cfg(any(unix, target_os = "wasi"))'.dev-dependencies]
36-
rustix = { version = "0.38.0", features = ["termios"] }
36+
rustix = { version = "0.38.44", features = ["termios"] }
3737
libc = "0.2.110"
3838

3939
[target.'cfg(not(any(windows, target_os = "hermit", target_os = "unknown")))'.dev-dependencies]

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
no_std
3737
)]
3838

39+
#[cfg(target_os = "wasi")]
40+
use std::os::fd::{AsFd, AsRawFd};
3941
#[cfg(target_os = "hermit")]
4042
use std::os::hermit::io::AsFd;
4143
#[cfg(unix)]
4244
use std::os::unix::io::{AsFd, AsRawFd};
43-
#[cfg(target_os = "wasi")]
44-
use std::os::wasi::io::{AsFd, AsRawFd};
4545
#[cfg(windows)]
4646
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle};
4747
#[cfg(windows)]
@@ -123,13 +123,13 @@ fn handle_is_console(handle: BorrowedHandle<'_>) -> bool {
123123

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

131131
// Otherwise, we fall back to an msys hack to see if we can detect the presence of a pty.
132-
msys_tty_on(handle)
132+
msys_tty_on(handle as HANDLE)
133133
}
134134
}
135135

0 commit comments

Comments
 (0)