@@ -404,6 +404,15 @@ function retest(args::Union{Module,AbstractString,Regex}...;
404
404
gotprinted = false
405
405
align_overflow = 0
406
406
407
+ function take_latest! (previewchan)
408
+ local desc
409
+ while isready (previewchan)
410
+ # printer/previewer can't take! it, as we locked
411
+ desc = take! (previewchan)
412
+ end
413
+ @isdefined (desc) ? desc : " "
414
+ end
415
+
407
416
previewer = previewchan === nothing ? nothing :
408
417
@async begin
409
418
timer = [' |' , ' /' , ' -' , ' \\ ' ]
@@ -413,13 +422,11 @@ function retest(args::Union{Module,AbstractString,Regex}...;
413
422
414
423
while ! finito
415
424
lock (printlock) do
416
- if isready (previewchan)
417
- # printer can't take! it, as we locked
418
- newdesc = take! (previewchan)
419
- if newdesc === nothing
420
- finito = true
421
- return
422
- end
425
+ newdesc = take_latest! (previewchan)
426
+ if newdesc === nothing
427
+ finito = true
428
+ return # no need to sleep before looping
429
+ elseif newdesc != " "
423
430
desc = newdesc
424
431
cursor = 0
425
432
gotprinted = false
@@ -494,8 +501,8 @@ function retest(args::Union{Module,AbstractString,Regex}...;
494
501
while ! finito
495
502
rts = take! (outchan)
496
503
lock (printlock) do
497
- if previewchan != = nothing && isready (previewchan)
498
- desc = take ! (previewchan)
504
+ if previewchan != = nothing
505
+ desc = take_latest ! (previewchan)
499
506
if desc === nothing
500
507
# keep `nothing` in so that the previewer knows to terminate
501
508
put! (previewchan, nothing )
0 commit comments