stopping the ticker on exit

This commit is contained in:
Federico Gimenez
2015-09-03 13:23:19 +02:00
parent b151734685
commit cf772ee4bc

View File

@@ -66,10 +66,12 @@ func forCommand(c *check.C, outputPattern string, cmds ...string) (err error) {
case <-tickChan:
output = execCommand(c, cmds...)
if match := re.FindString(output); match != "" {
ticker.Stop()
return
}
retries++
if retries >= MaxWaitRetries {
ticker.Stop()
return fmt.Errorf("Pattern not found in command output")
}
}