labath added a reviewer: amccarth.
labath added a comment.

I'm wondering if it would be possible/acceptable to move the color-related code 
from `llvm::raw_fd_ostream` (where the `RawOstreamForward` code is copied from) 
into the `raw_ostream` base class (except that it would default to false, of 
course). Outputting the color escape codes to a non-terminal, is not a 
completely unreasonable thing to do. For example, one gather the codes into a 
string stream, and later output the string to a real terminal -- which, 
incidentally, is exactly what we are doing here. Then all we would need is to 
plumb the "color" flag into the appropriate stream object.

One possible objection to that idea might be that this trick will work on 
windows only if we are using ansi emulation, which isn't always possible (I 
believe it's not available before windows 10). However, that objection applies 
regardless of where the feature is implemented -- the only difference is that 
we may be more willing to throw windows under the bus.

Another thing that would be good to check is whether these color codes make 
their way through the SB API (SBCommandReturnObject). I don't think that's a 
bad thing -- the embedding application might actually want to print lldb 
command results in color. And also, it provides a nice way to test this feature.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81058/new/

https://reviews.llvm.org/D81058



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to