@@ -7,6 +7,18 @@ import Base: wait, merge
77
88export OutputCollector, merge, collect_stdout, collect_stderr, tail, tee
99
10+ # Make sure we don't have problems when `Base.have_color` is `nothing`.
11+ function get_have_color ()
12+ @static if isdefined (Base, :get_have_color )
13+ return Base. get_have_color ()
14+ else
15+ # Compatibility with Julia v1.4-. Layman check for coloured output on
16+ # older Julia versions. TODO : remove this function when we drop support
17+ # for oldere versions of Julia.
18+ return something (Base. have_color, false )
19+ end
20+ end
21+
1022struct LineStream
1123 pipe:: Pipe
1224 lines:: Vector{Tuple{Float64,String}}
@@ -168,7 +180,7 @@ function wait(collector::OutputCollector)
168180 # If we failed, print out the tail of the output, unless we've been
169181 # tee()'ing it out this whole time, but only if the user said it's okay.
170182 if ! success (collector. P) && ! collector. verbose && collector. tail_error
171- our_tail = tail (collector; colored= Base . have_color )
183+ our_tail = tail (collector; colored= get_have_color () )
172184 print (collector. tee_stream, our_tail)
173185 end
174186 end
290302Spawn a background task to incrementally output lines from `collector` to the
291303standard output, optionally colored.
292304"""
293- function tee (c:: OutputCollector ; colored:: Bool = Base . have_color ,
305+ function tee (c:: OutputCollector ; colored:: Bool = get_have_color () ,
294306 stream:: IO = stdout )
295307 tee_task = @async begin
296308 out_idx = 1
0 commit comments