Skip to content

Commit

Permalink
fix process setup timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Aug 28, 2024
1 parent c4c111b commit 2588263
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,16 @@ func Execute(
}
}
if setupTime > 0 {
ch := make(chan struct{})
go func() {
_ = cmd.Wait()
ch <- struct{}{}
}()
time.Sleep(setupTime)
if b, _, _, _ := IsRunning(cmd.Process.Pid, ""); !b {
select {
case <-ch:
return 0, fmt.Errorf("process stopped during setup")
default:
}
}
return cmd.Process.Pid, nil
Expand Down

0 comments on commit 2588263

Please sign in to comment.