fix: server-side Ctrl-C handling for Windows x86_64 targets (attempt 2)

The current implementation of Ctrl-C handling was not properly tested on Windows x86_64 architectures. To address this, the code has been modified to use `i32` instead of `BOOL` to handle the result of the `GenerateConsoleCtrlEvent` function, ensuring that the return value is correctly checked across different platforms.
This commit is contained in:
Akarshan 2025-07-03 14:13:53 +05:30
parent 6ab7d37a08
commit 11db1ecaed
No known key found for this signature in database
GPG Key ID: D75C9634A870665F

View File

@ -201,12 +201,11 @@ pub async fn unload_llama_model(
#[cfg(all(windows, target_arch = "x86_64"))] #[cfg(all(windows, target_arch = "x86_64"))]
{ {
use windows_sys::Win32::Foundation::BOOL;
use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT}; use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT};
if let Some(raw_pid) = child.id() { if let Some(raw_pid) = child.id() {
log::info!("Sending Ctrl-C to PID {}", raw_pid); log::info!("Sending Ctrl-C to PID {}", raw_pid);
let ok: BOOL = unsafe { let ok: i32 = unsafe {
GenerateConsoleCtrlEvent(CTRL_C_EVENT, raw_pid as u32) GenerateConsoleCtrlEvent(CTRL_C_EVENT, raw_pid as u32)
}; };
if ok == 0 { if ok == 0 {