| 25 | ) |
| 26 | |
| 27 | func (r *Runc) command(context context.Context, args ...string) *exec.Cmd { |
| 28 | command := r.Command |
| 29 | if command == "" { |
| 30 | command = DefaultCommand |
| 31 | } |
| 32 | cmd := exec.CommandContext(context, command, append(r.args(), args...)...) |
| 33 | cmd.SysProcAttr = &syscall.SysProcAttr{ |
| 34 | Setpgid: r.Setpgid, |
| 35 | } |
| 36 | cmd.Env = filterEnv(os.Environ(), "NOTIFY_SOCKET") // NOTIFY_SOCKET introduces a special behavior in runc but should only be set if invoked from systemd |
| 37 | if r.PdeathSignal != 0 { |
| 38 | cmd.SysProcAttr.Pdeathsig = r.PdeathSignal |
| 39 | } |
| 40 | |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func filterEnv(in []string, names ...string) []string { |
| 45 | out := make([]string, 0, len(in)) |