mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 11:31:02 +00:00
internal/build: fix crash in MustRunCommandWithOutput (#28709)
This commit is contained in:
parent
9258a44b8f
commit
7124057bad
@ -68,23 +68,18 @@ func MustRunCommand(cmd string, args ...string) {
|
|||||||
MustRun(exec.Command(cmd, args...))
|
MustRun(exec.Command(cmd, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MustRunCommandWithOutput runs the given command, and ensures that some output will be
|
||||||
|
// printed while it runs. This is useful for CI builds where the process will be stopped
|
||||||
|
// when there is no output.
|
||||||
func MustRunCommandWithOutput(cmd string, args ...string) {
|
func MustRunCommandWithOutput(cmd string, args ...string) {
|
||||||
var done chan bool
|
interval := time.NewTicker(time.Minute)
|
||||||
// This is a little loop to generate some output, so CI does not tear down the
|
defer interval.Stop()
|
||||||
// process after 300 seconds.
|
|
||||||
go func() {
|
go func() {
|
||||||
for i := 0; i < 15; i++ {
|
for range interval.C {
|
||||||
fmt.Printf("Waiting for command %q\n", cmd)
|
fmt.Printf("Waiting for command %q\n", cmd)
|
||||||
select {
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
break
|
|
||||||
case <-done:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
MustRun(exec.Command(cmd, args...))
|
MustRun(exec.Command(cmd, args...))
|
||||||
close(done)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var warnedAboutGit bool
|
var warnedAboutGit bool
|
||||||
|
Loading…
Reference in New Issue
Block a user