bcc5c4a8bd
Driver plugin framework to facilitate development of driver plugins. Implementing plugins only need to implement the DriverPlugin interface. The framework proxies this interface to the go-plugin GRPC interface generated from the driver.proto spec. A testing harness is provided to allow implementing drivers to test the full lifecycle of the driver plugin. An example use: func TestMyDriver(t *testing.T) { harness := NewDriverHarness(t, &MyDiverPlugin{}) // The harness implements the DriverPlugin interface and can be used as such taskHandle, err := harness.StartTask(...) }
19 lines
453 B
Go
19 lines
453 B
Go
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
|
|
package utils
|
|
|
|
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
|
|
}
|