Implement platform-specific process attribute settings for llama server

This commit is contained in:
2025-07-26 21:02:57 +02:00
parent e7f0626ce5
commit f8b6cabb6c
3 changed files with 25 additions and 4 deletions

View File

@@ -41,10 +41,7 @@ func (i *Instance) Start() error {
i.cmd = exec.CommandContext(i.ctx, "llama-server", args...) i.cmd = exec.CommandContext(i.ctx, "llama-server", args...)
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
if i.cmd.SysProcAttr == nil { setProcAttrs(i.cmd)
i.cmd.SysProcAttr = &syscall.SysProcAttr{}
}
i.cmd.SysProcAttr.Setpgid = true
} }
var err error var err error

15
pkg/process_group_unix.go Normal file
View File

@@ -0,0 +1,15 @@
//go:build !windows
package llamactl
import (
"os/exec"
"syscall"
)
func setProcAttrs(cmd *exec.Cmd) {
if cmd.SysProcAttr == nil {
cmd.SysProcAttr = &syscall.SysProcAttr{}
}
cmd.SysProcAttr.Setpgid = true
}

View File

@@ -0,0 +1,9 @@
//go:build windows
package llamactl
import "os/exec"
func setProcAttrs(cmd *exec.Cmd) {
// No-op on Windows
}