Output depends if gradle its attached to a console

Gradle has option console which behaves differently if gradle is not attached to a console. From docs:

Set to auto (the default) to enable color and other rich output in the console output 
when the build process is attached to a console, or to generate plain text only when not 
attached to a console. This is the default when Gradle is attached to a terminal.

When I run it locally with default parameter I see rich output, but when in Jenkins - plain.

What does is mean when program is attached to a terminal? Don’t we always run CLI programs through the terminal?

No, if you for example run it as Jenkins build or through IDE integration and os on, no terminal is attached.
Or if you redirect the output to a pipe like ./gradlew build | grep foo then also no terminal is attached to the process.

1 Like