Skip to content

Commit

Permalink
Ensure cmd.SysProcAttr is set before modifying it (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uvedale authored and priyawadhwa committed Aug 7, 2018
1 parent 53b5fb4 commit 2261adc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (r *RunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bui
cmd.Stderr = os.Stderr
replacementEnvs := buildArgs.ReplacementEnvs(config.Env)
cmd.Env = replacementEnvs
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

// If specified, run the command as a specific user
if config.User != "" {
Expand Down Expand Up @@ -91,7 +92,6 @@ func (r *RunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bui
}
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
}
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

if err := cmd.Start(); err != nil {
return errors.Wrap(err, "starting command")
Expand Down

0 comments on commit 2261adc

Please sign in to comment.