We’re trying to execute an xbuild code-analysis function using project.exec() and can’t seem to get xbuild to find it acceptable to output color codes. We’d sure love it if it did.
I’m ssh’d in to my machine and have set TERM to “xterm-color”. I can run the command from the command-line and it works swell:
/usr/bin/xbuild /property:Configuration=CodeAnalysis “/property:Platform=Any CPU” /verbosity:minimal /target:Build /p:CommandLineDefineConstants=Linux PathToSolutionFile
All errors and warnings show up in red and yellow respectively. This is really what we’re after, given that xbuild only uses STDOUT… We’d love to use these colors to interpret error-level per line.
Run through project.exec, the same command will not output color. I am not a Linux guru, but I understand that the called program is what determines whether it is being run in a terminal and is what chooses whether or not to use color codes.
Question is: Can Gradle execute subprocesses as if they were run in a terminal or in a way that the called program can’t tell it’s run in a subprocess? Is this something in Gradle’s power?