github.com/hernad/nomad@v1.6.112/drivers/nix/_executor/utils_unix.go (about) 1 //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 2 // +build darwin dragonfly freebsd linux netbsd openbsd solaris 3 4 package executor 5 6 import ( 7 "os/exec" 8 "syscall" 9 ) 10 11 // isolateCommand sets the setsid flag in exec.Cmd to true so that the process 12 // becomes the process leader in a new session and doesn't receive signals that 13 // are sent to the parent process. 14 func isolateCommand(cmd *exec.Cmd) { 15 if cmd.SysProcAttr == nil { 16 cmd.SysProcAttr = &syscall.SysProcAttr{} 17 } 18 cmd.SysProcAttr.Setsid = true 19 }