Exec creates a new process with the specified arguments.
(ctx context.Context, name string, arg ...string)
| 27 | |
| 28 | // Exec creates a new process with the specified arguments. |
| 29 | func Exec(ctx context.Context, name string, arg ...string) *exec.Cmd { |
| 30 | // create a process group |
| 31 | sysProcAttr := &syscall.SysProcAttr{ |
| 32 | Setpgid: true, |
| 33 | } |
| 34 | cmd := exec.CommandContext(ctx, name, arg...) |
| 35 | cmd.SysProcAttr = sysProcAttr |
| 36 | return cmd |
| 37 | } |
| 38 | |
| 39 | // Kill the process and subprocesses. |
| 40 | func Kill(cmd *exec.Cmd) error { |