pomerium/integration/internal/cluster/cmd_linux.go
bobby 1565d25d32
ci: use go 1.17.x (#2492)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2021-08-19 21:13:36 -07:00

25 lines
433 B
Go

//go:build linux
// +build linux
package cluster
import (
"context"
"os/exec"
"syscall"
"github.com/onsi/gocleanup"
)
func commandContext(ctx context.Context, name string, args ...string) *exec.Cmd {
cmd := exec.CommandContext(ctx, name, args...)
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: syscall.SIGTERM,
}
gocleanup.Register(func() {
if cmd.Process != nil {
_ = cmd.Process.Kill()
}
})
return cmd
}