Skip to content

Commit

Permalink
much more concise way of deferring the flush
Browse files Browse the repository at this point in the history
  • Loading branch information
tigh-latte committed Oct 5, 2024
1 parent df3f449 commit 7f26697
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,9 @@ func (r *runner) concurrent(rate int) (failed bool) {
if rate > 1 {
// if running concurrently, only print at end of scenario to keep
// scenario logs segregated
suite.fmt = ifmt.WrapOnFlush(testSuiteContext.suite.fmt)
defer func() {
// if log can be flushed, do so. Should always be true but it's
// better to be safe.
if fmttr, ok := suite.fmt.(formatters.FlushFormatter); ok {
fmttr.Flush()
}
}()
ffmt := ifmt.WrapOnFlush(testSuiteContext.suite.fmt)
suite.fmt = ffmt
defer ffmt.Flush()
}

if r.scenarioInitializer != nil {
Expand Down

0 comments on commit 7f26697

Please sign in to comment.