Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(windows): suppress the worker console window on arm64

Akarshan Biswas4e4bd12f5481
diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/worker.rs b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/worker.rs
index f6c367e6b..72363bdbb 100644
--- a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/worker.rs
+++ b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/worker.rs
@@ -318,9 +318,9 @@ impl WorkerHandle {
#[cfg(unix)]
crate::process::graceful_terminate_process(&mut self.child).await;
- #[cfg(all(windows, target_arch = "x86_64"))]
+ #[cfg(windows)]
crate::process::force_terminate_process(&mut self.child).await;
- #[cfg(not(any(unix, all(windows, target_arch = "x86_64"))))]
+ #[cfg(not(any(unix, windows)))]
{
let _ = self.child.kill().await;
}
diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/src/process.rs b/src-tauri/plugins/tauri-plugin-llamacpp/src/process.rs
index 695204be3..7f728c482 100644
--- a/src-tauri/plugins/tauri-plugin-llamacpp/src/process.rs
+++ b/src-tauri/plugins/tauri-plugin-llamacpp/src/process.rs
@@ -25,7 +25,7 @@ pub async fn graceful_terminate_process(child: &mut tokio::process::Child) {
}
}
-#[cfg(all(windows, target_arch = "x86_64"))]
+#[cfg(windows)]
pub async fn force_terminate_process(child: &mut tokio::process::Child) {
// Graceful shutdown is not implemented on Windows: llama-server's console
// handler only reacts to CTRL_C_EVENT (server.cpp), and
diff --git a/src-tauri/utils/src/system.rs b/src-tauri/utils/src/system.rs
index 830ae9516..974ad2da8 100644
--- a/src-tauri/utils/src/system.rs
+++ b/src-tauri/utils/src/system.rs
@@ -587,13 +587,13 @@ fn collect_flatpak_gl_paths(cuda_lib_paths: &mut std::collections::HashSet<Strin
}
pub fn setup_windows_process_flags(command: &mut tokio::process::Command) {
- #[cfg(all(windows, target_arch = "x86_64"))]
+ #[cfg(windows)]
{
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
const CREATE_NEW_PROCESS_GROUP: u32 = 0x0000_0200;
command.creation_flags(CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP);
}
- #[cfg(not(all(windows, target_arch = "x86_64")))]
+ #[cfg(not(windows))]
{
let _ = command; // Silence unused parameter warning on non-Windows platforms
}