You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure when exactly it stops working, consider the following code that redirects the colored printing to a Pipe buffer then read the String from it, I'm expecting to get the string with the corresponding ASCII color, but I only get the no-color printing.
I believe this is currently causing the color_output macro from Suppressor not working anymore (JuliaIO/Suppressor.jl#40, this is a separate issue due to the change of return value of redirect_stdout from Tuple{PipeEndpoint, PipeEndpoint} to PipeEndpoint). And it seems because the PipeEndpoint will return false for get(io, :color, false) inside with_output_color.
Currently the difference is for the default stdout, we have
but not for PipeEndpoint, I notice there has been discussion on this here #36671, thus I'm wondering what would be the best way to fix this? define a similar overload for PipeEndpoint seems not preferred since that could be a file? How do we allow users to turn on/off the color option when trying to dump the stdout to a string then?
The text was updated successfully, but these errors were encountered:
Roger-luo
changed the title
redirect_* doesn't work with have_color anymore
redirect_* doesn't work with have_color
Dec 29, 2021
The workaround would be to use redirect_stdout(IOContext(Pipe(), :color=>Base.get_have_color())).
We should possibly copy properties from the original stdout in redirect_stdout(), but I'm not sure...
I would say this is intentional, and not intended that we clone values from old stdout (which you can do explicitly, as you show). But perhaps we should apply --color=yes to the new stdout/stderr, if the user set that command line flag?
vtjnash
added
the
io
Involving the I/O subsystem: libuv, read, write, etc.
label
Jan 7, 2022
I'm not sure when exactly it stops working, consider the following code that redirects the colored printing to a
Pipe
buffer then read theString
from it, I'm expecting to get the string with the corresponding ASCII color, but I only get the no-color printing.I believe this is currently causing the
color_output
macro fromSuppressor
not working anymore (JuliaIO/Suppressor.jl#40, this is a separate issue due to the change of return value ofredirect_stdout
fromTuple{PipeEndpoint, PipeEndpoint}
toPipeEndpoint
). And it seems because thePipeEndpoint
will return false forget(io, :color, false)
insidewith_output_color
.Currently the difference is for the default
stdout
, we havejulia/base/ttyhascolor.jl
Line 27 in f61eb87
but not for
PipeEndpoint
, I notice there has been discussion on this here #36671, thus I'm wondering what would be the best way to fix this? define a similar overload forPipeEndpoint
seems not preferred since that could be a file? How do we allow users to turn on/off the color option when trying to dump thestdout
to a string then?The text was updated successfully, but these errors were encountered: