这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(deps): use windows-sys instead of winapi #9805

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

Merged
merged 1 commit into from
Jan 29, 2025
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
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ uds_windows = "1.0.2"
async-io = "1.12.0"

[target.'cfg(target_os = "windows")'.dev-dependencies]
winapi = "0.3.9"
windows-sys = { version = "0.59", features = ["Win32_System_Threading"] }

[build-dependencies]
capnpc = "0.18.0"
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-lib/src/process/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,9 +1092,9 @@ mod test {
if let Some(pid) = child.pid() {
unsafe {
println!("killing");
winapi::um::processthreadsapi::TerminateProcess(
winapi::um::processthreadsapi::OpenProcess(
winapi::um::winnt::PROCESS_TERMINATE,
windows_sys::Win32::System::Threading::TerminateProcess(
windows_sys::Win32::System::Threading::OpenProcess(
windows_sys::Win32::System::Threading::PROCESS_TERMINATE,
0,
pid,
),
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ turbopath = { workspace = true }
turborepo-ci = { workspace = true }
turborepo-vt100 = { workspace = true }
which = { workspace = true }
winapi = "0.3.9"

[target."cfg(windows)".dependencies]
clipboard-win = "5.3.1"
windows-sys = { version = "0.59", features = ["Win32_System_Console"] }
12 changes: 6 additions & 6 deletions crates/turborepo-ui/src/tui/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ fn ctrl_c() -> Option<Event> {

#[cfg(windows)]
fn ctrl_c() -> Option<Event> {
use winapi::{
shared::minwindef::{BOOL, DWORD, TRUE},
um::wincon,
use windows_sys::Win32::{
Foundation::{BOOL, TRUE},
System::Console::GenerateConsoleCtrlEvent,
};
// First parameter corresponds to what event to generate, 0 is a Ctrl-C
let ctrl_c_event: DWORD = 0x0;
let ctrl_c_event = 0x0;
// Second parameter corresponds to which process group to send the event to.
// If 0 is passed the event gets sent to every process connected to the current
// Console.
let process_group_id: DWORD = 0x0;
let process_group_id = 0x0;
let success: BOOL = unsafe {
// See docs https://learn.microsoft.com/en-us/windows/console/generateconsolectrlevent
wincon::GenerateConsoleCtrlEvent(ctrl_c_event, process_group_id)
GenerateConsoleCtrlEvent(ctrl_c_event, process_group_id)
};
if success == TRUE {
None
Expand Down
Loading