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