@@ -7,6 +7,18 @@ import Base: wait, merge
7
7
8
8
export OutputCollector, merge, collect_stdout, collect_stderr, tail, tee
9
9
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
+
10
22
struct LineStream
11
23
pipe:: Pipe
12
24
lines:: Vector{Tuple{Float64,String}}
@@ -168,7 +180,7 @@ function wait(collector::OutputCollector)
168
180
# If we failed, print out the tail of the output, unless we've been
169
181
# tee()'ing it out this whole time, but only if the user said it's okay.
170
182
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 () )
172
184
print (collector. tee_stream, our_tail)
173
185
end
174
186
end
290
302
Spawn a background task to incrementally output lines from `collector` to the
291
303
standard output, optionally colored.
292
304
"""
293
- function tee (c:: OutputCollector ; colored:: Bool = Base . have_color ,
305
+ function tee (c:: OutputCollector ; colored:: Bool = get_have_color () ,
294
306
stream:: IO = stdout )
295
307
tee_task = @async begin
296
308
out_idx = 1
0 commit comments