2016-02-13 00:20:04 +00:00
|
|
|
// +build !linux,!windows
|
2016-02-08 18:05:39 +00:00
|
|
|
|
2016-02-08 03:33:48 +00:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// isolateCommand sets the setsid flag in exec.Cmd to true so that the process
|
|
|
|
// becomes the process leader in a new session and doesn't receive signals that
|
|
|
|
// are sent to the parent process.
|
|
|
|
func isolateCommand(cmd *exec.Cmd) {
|
|
|
|
if cmd.SysProcAttr == nil {
|
|
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
|
|
}
|
|
|
|
cmd.SysProcAttr.Setsid = true
|
|
|
|
}
|