github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/client/driver/utils_posix.go (about)

     1  // +build !linux,!windows
     2  
     3  package driver
     4  
     5  import (
     6  	"os/exec"
     7  	"syscall"
     8  )
     9  
    10  // isolateCommand sets the setsid flag in exec.Cmd to true so that the process
    11  // becomes the process leader in a new session and doesn't receive signals that
    12  // are sent to the parent process.
    13  func isolateCommand(cmd *exec.Cmd) {
    14  	if cmd.SysProcAttr == nil {
    15  		cmd.SysProcAttr = &syscall.SysProcAttr{}
    16  	}
    17  	cmd.SysProcAttr.Setsid = true
    18  }