pal
pal

Reputation: 949

Weird control characters from Gradle in Windows 10

In the console I get "funky" output from Gradle when run from CMD since switching to Windows 10.

[0K
[0K
[2A[1m<==-----------> 18% EXECUTING [9s][m[34D[1B[1m> :compileScala[m[15D[1B[2A[1m<==-----------> 18% EXECUTING [10s][m[35D[2B[2A[1m<==-----------> 18% EXECUTING [11s][m[35D[2B[2A[1m<==-----------> 18% EXECUTING [12s][m[35D[2B[2A[1m<==-----------> 18% EXECUTING [13s][m[35D[2B[2A[1m<==-----------> 18% EXECUTING [14s][m[35D[2B[2Athere were four feature warnings; re-run with -feature for details
four warnings found

I imagine this is some sort of control-characters-gone-wild where Gradle is trying to sensibly colour its output and Windows is interpreting that wrong. PowerShell and SBT works fine - but copying the console "Properties" settings from PowerShell to CMD doesn't fixit.

Has anyone resolved this?

UPDATE 2018-01-28 It's also happening in my Jenkins/Alpine/Docker setup atop OSX/macOS/whatnot. Not just windows anymore.

... but ... it doesn't happen in the Surface laptop work gave me ... super weird. Whatevs gradlew --console=plain works fine for me.

Upvotes: 21

Views: 7208

Answers (6)

Anonsage
Anonsage

Reputation: 8320

The solution for me was to just update Git Bash: git update-git-for-windows

Upvotes: -1

velocity
velocity

Reputation: 2096

like @lance-java said the ANSI output can be disabled throw the command line option --console

./gradle bootRun --console plain 

or

./gradle bootRun --console=plain

another way is to set the property in the gradle.properties file

org.gradle.console=plain 

see documentation: Gradle configuration properties

Upvotes: 0

jannis
jannis

Reputation: 5230

I get the same problem when using Windows Terminal and "Git Bash" profile added automatically by GIT installer. For me the solution was to change the command-line for starting the terminal from <git_install_path>/bin/bash.exe to <git_install_path>/bin/usr/bash.exe following this advice.

Upvotes: 1

Mark McClelland
Mark McClelland

Reputation: 5298

I've seen this happen in the Git BASH shell that's part of Git For Windows. For me, the solution was to set TERM to cygwin. This fixed the output without introducing any issues handling backspace.

export TERM=cygwin

I also tried xterm, xterm-256color, ansi, and vt100. The cygwin term has been the most reliable for me. I'm now running \usr\bin\bash.exe in Windows Terminal, and so far it has worked well.

Upvotes: 43

Jerry
Jerry

Reputation: 1197

To fix this on Windows 10 create a new DWORD key HKEY_CURRENT_USER\Console\VirtualTerminalLevel set to 1. See this for more info.

Upvotes: 1

lance-java
lance-java

Reputation: 28016

I'm guessing you could pass --console plain in the gradle command line to disable the rich console which is likely the cause of the "funky" characters

https://docs.gradle.org/current/userguide/gradle_command_line.html

Upvotes: 13

Related Questions