2026-10-24 09:49:16 +02:00
|
|
|
//go:build windows
|
|
|
|
|
|
|
|
|
|
package daemon
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os/exec"
|
|
|
|
|
"syscall"
|
|
|
|
|
)
|
|
|
|
|
|
2026-10-24 11:15:35 +02:00
|
|
|
// detachedProcess is the Win32 flag DETACHED_PROCESS: no console window, no
|
|
|
|
|
// binding to the caller's console.
|
2026-10-24 09:49:16 +02:00
|
|
|
const detachedProcess = 0x00000008
|
|
|
|
|
|
2026-10-24 11:15:35 +02:00
|
|
|
// detach detaches the child from the console: own process group (no Ctrl-C
|
|
|
|
|
// from the shell) and no console (no flashing window).
|
2026-10-24 09:49:16 +02:00
|
|
|
func detach(cmd *exec.Cmd) {
|
|
|
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
|
|
|
|
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP | detachedProcess,
|
|
|
|
|
}
|
|
|
|
|
}
|