Skip to content

Commit

Permalink
fix(windows): prevent infinite run. Fixes #11810 (#11993)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Weibel <michael@helio.exchange>
  • Loading branch information
mweibel committed Oct 13, 2023
1 parent 3f56eb3 commit bf735a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
15 changes: 0 additions & 15 deletions workflow/executor/os-specific/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,13 @@ package os_specific
import (
"io"
"os"
"os/exec"
"time"

log "github.com/sirupsen/logrus"
"golang.org/x/term"
)

var logger = log.WithField("argo", true)

func simpleStart(cmd *exec.Cmd) (func(), error) {
if err := cmd.Start(); err != nil {
return nil, err
}

closer := func() {
cmd.WaitDelay = 100 * time.Millisecond
_ = cmd.Wait()
}

return closer, nil
}

func isTerminal(stdin io.Reader) bool {
f, ok := stdin.(*os.File)
return ok && term.IsTerminal(int(f.Fd()))
Expand Down
14 changes: 14 additions & 0 deletions workflow/executor/os-specific/command_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os/exec"
"os/signal"
"syscall"
"time"

"github.com/creack/pty"
"golang.org/x/term"
Expand Down Expand Up @@ -88,3 +89,16 @@ func StartCommand(cmd *exec.Cmd) (func(), error) {

return closer, nil
}

func simpleStart(cmd *exec.Cmd) (func(), error) {
if err := cmd.Start(); err != nil {
return nil, err
}

closer := func() {
cmd.WaitDelay = 100 * time.Millisecond
_ = cmd.Wait()
}

return closer, nil
}
11 changes: 11 additions & 0 deletions workflow/executor/os-specific/command_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ func StartCommand(cmd *exec.Cmd) (func(), error) {
}
return simpleStart(cmd)
}

func simpleStart(cmd *exec.Cmd) (func(), error) {
if err := cmd.Start(); err != nil {
return nil, err
}

closer := func() {
}

return closer, nil
}

0 comments on commit bf735a2

Please sign in to comment.