From 11db1ecaeda4f26dada6e75cd5b1ba9aa2aac7f8 Mon Sep 17 00:00:00 2001 From: Akarshan Date: Thu, 3 Jul 2025 14:13:53 +0530 Subject: [PATCH] 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. --- .../utils/extensions/inference_llamacpp_extension/server.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs b/src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs index a38b72810..0b8466ffd 100644 --- a/src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs +++ b/src-tauri/src/core/utils/extensions/inference_llamacpp_extension/server.rs @@ -201,12 +201,11 @@ pub async fn unload_llama_model( #[cfg(all(windows, target_arch = "x86_64"))] { - use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT}; if let Some(raw_pid) = child.id() { 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) }; if ok == 0 {