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

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