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.
Solution 1:
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.
Solution 2:
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
Solution 3:
To fix this on Windows 10 create a new DWORD
key HKEY_CURRENT_USER\Console\VirtualTerminalLevel
set to 1
. See this for more info.