Skip to content

Commit

Permalink
Avoid parent process if no log redirection is used
Browse files Browse the repository at this point in the history
Exec the command without forking in case go-runner
does not need to perform log output redirection.

Signed-off-by: Marc Hoersken <[email protected]>
  • Loading branch information
mback2k committed May 23, 2024
1 parent f294861 commit 46b84f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions images/build/go-runner/go-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func configureAndRun() error {
cmd.Stderr = errStream

log.Printf("Running command:\n%v", cmdInfo(cmd))
if cmd.Stdout == os.Stdout && cmd.Stderr == os.Stderr {
syscall.Exec(exe, exeArgs, syscall.Environ())
}

err := cmd.Start()
if err != nil {
return fmt.Errorf("starting command: %w", err)
Expand Down

0 comments on commit 46b84f1

Please sign in to comment.