Skip to content

Commit

Permalink
fix imports for Windows-only code
Browse files Browse the repository at this point in the history
  • Loading branch information
apparebit committed Nov 7, 2024
1 parent 0ab3eda commit f464024
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 64 deletions.
63 changes: 4 additions & 59 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ pyo3 = { version = "0.22.5", features = ["extension-module", "abi3", "abi3-py311
[target.'cfg(unix)'.dependencies]
libc = { version = "0.2.161", optional = true }

[target.'cfg(windows)'.dependencies.windows]
version = "0.58.0"
[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.59.0"
optional = true
features = [
"Win32_System_Console"
]

[features]
default = ["f64", "term"]
f64 = []
gamut = []
pyffi = ["dep:pyo3"]
term = ["dep:libc", "dep:windows"]
term = ["dep:libc", "dep:windows-sys"]


[lib]
Expand Down
10 changes: 8 additions & 2 deletions src/term/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
//! For that same reason, [`Config`], [`Reader`], and [`Writer`] must not be
//! directly exposed to application code.
use std::io::{Error, ErrorKind, Result};
use std::fs::OpenOptions;
use std::io::{Error, ErrorKind, Read, Result, Write};
use std::os::windows::io::{AsRawHandle, OwnedHandle};
use std::ptr::{from_mut, from_ref};
use std::ptr::from_mut;

use windows_sys::Win32::System::Console::{GetConsoleMode, SetConsoleMode};

use super::RawHandle;
use crate::term::Options;

/// A trait for converting Windows status BOOL to Rust std::io results.
trait IntoResult {
Expand Down

0 comments on commit f464024

Please sign in to comment.