fix: prevent terminal window from opening on model load on WindowsOS (#5837)

On Windows, spawning the llamacpp server was causing an unwanted terminal window
to appear. This is now fixed by combining `CREATE_NO_WINDOW` with
`CREATE_NEW_PROCESS_GROUP` using `.creation_flags(...)`, ensuring that the
process runs in the background without a console window.

This change only applies to 64-bit Windows builds.
This commit is contained in:
Akarshan Biswas 2025-07-21 13:24:31 +05:30 committed by GitHub
parent 05b9d4e9fd
commit 08de0fa42d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,8 +144,9 @@ pub async fn load_llama_model(
#[cfg(all(windows, target_arch = "x86_64"))]
{
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
const CREATE_NEW_PROCESS_GROUP: u32 = 0x0000_0200;
command.creation_flags(CREATE_NEW_PROCESS_GROUP);
command.creation_flags(CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP);
}
// Spawn the child process