WaitForNth blocks until the accumulated output contains at least n occurrences of signal, or ctx expires. Returns nil on match, ctx.Err() on timeout. Safe to call from any goroutine.
(ctx context.Context, signal string, n int)
| 60 | // n occurrences of signal, or ctx expires. Returns nil on match, |
| 61 | // ctx.Err() on timeout. Safe to call from any goroutine. |
| 62 | func (wb *WaitBuffer) WaitForNth(ctx context.Context, signal string, n int) error { |
| 63 | return wb.WaitForCond(ctx, func(s string) bool { |
| 64 | return strings.Count(s, signal) >= n |
| 65 | }) |
| 66 | } |
| 67 | |
| 68 | // WaitForCond blocks until cond returns true for the accumulated |
| 69 | // output, or ctx expires. Returns nil on match, ctx.Err() on |