Skip to content

Commit

Permalink
Set SysProcAttr Foreground: true when user run cmd
Browse files Browse the repository at this point in the history
Fixes: #404
  • Loading branch information
sarim authored and fabpot committed May 6, 2024
1 parent a2228df commit c1dbc0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion local/runner.go
Expand Up @@ -277,7 +277,7 @@ func (r *Runner) buildCmd() (*exec.Cmd, error) {
cmd.Env = os.Environ()
cmd.Dir = r.pidFile.Dir

if err := buildCmd(cmd); err != nil {
if err := buildCmd(cmd, r.mode == RunnerModeOnce); err != nil {
return nil, err
}

Expand Down
5 changes: 3 additions & 2 deletions local/runner_posix.go
Expand Up @@ -8,11 +8,12 @@ import (
"syscall"
)

func buildCmd(cmd *exec.Cmd) error {
func buildCmd(cmd *exec.Cmd, foreground bool) error {
cmd.SysProcAttr = &syscall.SysProcAttr{
// isolate each command in a new process group that we can cleanly send
// signal to when we want to stop it
Setpgid: true,
Setpgid: true,
Foreground: foreground,
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion local/runner_windows.go
Expand Up @@ -2,6 +2,6 @@ package local

import "os/exec"

func buildCmd(*exec.Cmd) error {
func buildCmd(*exec.Cmd, bool) error {
return nil
}

0 comments on commit c1dbc0b

Please sign in to comment.