Skip to content

Commit

Permalink
fix test case rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
xiantang committed Jun 23, 2024
1 parent 674a5b9 commit a759095
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runner/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Engine struct {
binStopCh chan bool
exitCh chan bool

cleanupWg sync.WaitGroup
procKillWg sync.WaitGroup
mu sync.RWMutex
watchers uint
round uint64
Expand Down Expand Up @@ -481,7 +481,6 @@ func (e *Engine) runPostCmd() error {
}

func (e *Engine) runBin() error {
e.cleanupWg.Add(1)
killFunc := func(cmd *exec.Cmd, stdout io.ReadCloser, stderr io.ReadCloser, killCh chan struct{}, processExit chan struct{}, wg *sync.WaitGroup) {
defer wg.Done()
select {
Expand Down Expand Up @@ -540,6 +539,7 @@ func (e *Engine) runBin() error {
case <-killCh:
return
default:
e.procKillWg.Add(1)
command := strings.Join(append([]string{e.config.Build.Bin}, e.runArgs...), " ")
cmd, stdout, stderr, _ := e.startCmd(command)
processExit := make(chan struct{})
Expand Down Expand Up @@ -575,7 +575,7 @@ func (e *Engine) runBin() error {
default:
e.runnerLog("Process Exit with Code: %v", state.ExitCode())
}
e.cleanupWg.Done()
e.procKillWg.Done()

if !e.config.Build.Rerun {
return
Expand Down Expand Up @@ -625,7 +625,7 @@ func (e *Engine) cleanup() {
}

e.mainDebug("waiting for exit...")
e.cleanupWg.Wait()
e.procKillWg.Wait()
e.running = false
e.mainDebug("exited")
}
Expand Down

0 comments on commit a759095

Please sign in to comment.