Boost logo

Boost-Build :

Subject: Re: [Boost-build] Color console output
From: Chambers, Matthew (matt.chambers42_at_[hidden])
Date: 2016-10-27 13:58:37


On 10/18/2016 1:21 AM, Vladimir Prus wrote:
>
> Matthew,
>
> On 17-Oct-16 9:02 PM, Chambers, Matthew wrote:
>> Is there any interest in having BB emit its warning and error messages
>> in color? It's just a matter of writing ANSI color codes on modern *nix
>> shells, but even in Windows cmd.exe it's possible. I think it would be
>> very helpful for quickly discriminating between mundane build text,
>> error/warning messages, and in the case of failed actions, the body of
>> the action that failed.
>
> I think there is interest, and it was suggested in https://svn.boost.org/trac/boost/ticket/3508. There were no actual patches though.
>
>>
>> For Windows, it requires a few system calls:
>> http://stackoverflow.com/questions/7778392/colorize-stdout-output-to-windows-cmd-exe-from-console-c-app
>
> It's good to know it can work on Windows, I though it's a Unix thing.

Hi Vlad,

I started work on implementing this in bjam's `output.c`. I started with a simple approach, with hardcoded `SetConsoleTextAttribute()` calls
inside `output.c/out_()`. This made the actions output text show in yellow. It works when bootstrapping with `jam0.exe` (it shows the
compiled sources and "1 file(s) copied" in yellow and the rest in gray), but not when running `b2 install`.

The bootstrap command is originally:

     bootstrap\jam0.exe -f build.jam --toolset=vc14 "--toolset-root=C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\Tools\..\..\VC\ "

When I run the bootstrapper jamfile using the b2 executable that just got bootstrapped, I still get color:

     bin.ntx86\b2.exe -f build.jam --toolset=vc14 "--toolset-root=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\..\VC\ "

However, if I try to build the main Boost.Build system, with `b2 install`, I don't get any color. My "1 file(s) copied" are all in boring
gray. This seems to have something to do with the environment that gets set up by the Boost.Build jamfiles, but I have no idea what it could
be, so I'm asking here.

Thanks,
-Matt


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk