<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 6:51 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">>But what if Lit isn't running in a device capable of color output? Won't<br>
>this add a bunch of ugly ASCII codes?<br>
<br>
</span>Wouldn't clang refrain from outputting color codes to begin with?<br></blockquote><div><br>I believe it doesn't know any better, if you've given it a pseudoterminal capable of colours, it'll go for it.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Do you know of any way to detect this?<br></blockquote><div><br>The same way clang, lit, and FileCheck detect it, I suppose... (I'm sure there's some API in libSupport, though I realize that won't be directly usable from this python, but might give you some inspiration)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
>I think what tools like Ninja do is to also optionally strip the color<br>
>codes in that case (<br>
><a href="https://github.com/martine/ninja/blob/master/src/util.cc#L384" target="_blank">https://github.com/martine/ninja/blob/master/src/util.cc#L384</a>).<br>
<br>
</span>Not much you can do about that. At least the colored output makes it one step further.<br></blockquote><div><br>Agreed (& note that FileCheck is also a great candidate for this). For now I just use the compiler flags in cmake to force Clang's colours on. This doesn't work if I want to redirect, of course, and doesn't work for FileCheck (due to lit) nor lit (due to Ninja) - having an option to force these things on would be fine by me too, so I could do the same with those tools as I do with clang (& indeed if you make this change to lit and give me a "force colours" flag (or manage to get it in without the terminal detection so it's just always on - but I suspect that'd be bad, as Daniel pointed out) then I might not need a flag for FileCheck and I can remove the flag passing I have for clang... )<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks for the input.<br>
<div class="HOEnZb"><div class="h5"><br>
<a href="http://reviews.llvm.org/D6010" target="_blank">http://reviews.llvm.org/D6010</a><br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>