8

I really enjoy how the SBT, the Scala Build Tool, can send out ctrl characters to format a console window.

But now, I start SBT, on Windows 10, on a valid project and issue a compile command. Instead of the window staying static, as it used to, now the compiler scrolls the window, sending lines of control characters, like,

C:\daut>sbt
←[0m[←[0m←[0minfo←[0m] ←[0m←[0mwelcome to sbt 1.3.13 (OpenLogic- 
OpenJDK Java 1.8.0-262)←[0m
←[0m[←[0m←[0minfo←[0m] ←[0m←[0mloading global plugins from 
C:\Users\plugins←[0m

or, ←[2K  | => daut / Compile / previousCompile 0s
←[13A←[2K
←[2K
←[2K

============================================== What a disappointment. Everything else like actual the compilation seems correct.

Now. Is there some way, to make SBT, not send out these '←[13A←[2K' characters, I have reinstalled the software, that is, JAVA, SBT, Scala, but those changes do not help.

I really enjoyed how SBT, used to perform. Why? has SBT lost the ability to format a console window? The projects I am using have been downloaded fresh from github.

tom
  • 91
  • 2
  • It has nothing to do with scala sbt or java. Your terminal controls the colors. Please check this [question](https://stackoverflow.com/questions/3629918/how-do-i-get-color-coded-console-output-from-sbt-on-windows) – Ivan Stanislavciuc Feb 27 '21 at 09:31
  • you could add `-Dsbt.log.noformat=true` to SBT_OPTS to disable color formatting completely – Ivan Stanislavciuc Feb 27 '21 at 09:33
  • For a short-term workaround, you can also run your command line with `-no-color` to disable fancy formatting. – user3468054 Aug 19 '21 at 09:51

4 Answers4

3

I had this problem (in both cmd.exe and Powershell). Based on this comment, I edited the registry to add a DWORD named VirtualTerminalLevel, value 0x1, under HKEY_CURRENT_USER\Console.

After restarting cmd.exe/Powershell, both now seem to work.

I don't really understand why this helped - and a colleague of mine has it working perfectly under cmd.exe without this registry value.

user3468054
  • 610
  • 4
  • 11
  • How to Add a New DWORD in Regedit: Launch the Registry Editor by clicking "Start," typing "regedit" in the "Start Search" field and pressing "Enter" – capo11 Jul 06 '22 at 13:18
2

I had exact same problem, it first happened using Powershell so I started using Bash and then there was no display on the command line (https://github.com/sbt/sbt/issues/4173). I came back to Powershell and for now is working.

I have also tried the integrated bash terminal on VScode and same problemn that you mentionned.

For now I'm working on VsCode with a Powershell integrated terminal and seems to work. If it helps.

Carlos F
  • 21
  • 3
2

According to the FAQ:

How do I disable ansi codes in the output?

Sometimes sbt doesn’t detect that ansi codes aren’t supported and you get output that looks like:

[0m[ [0minfo [0m]  [0mSet current project to root

or ansi codes are supported but you want to disable colored output. To completely disable ansi codes, pass -no-colors option:

$ sbt -no-colors
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
1

I also was having the similar issue. By typing sbt -version I saw difference in the "sbt version in this project" and "sbt script version". At first I had sbt 1.5.5, then I installed similar version to the project's (sbt 1.3.13).

At the end it looked like this and problem was solved:

sbt version in this project: 1.3.13
sbt script version: 1.3.13