Extra Characters When Running CommandBox in Git Bash

For quite some time - several years at least - I have been running CommandBox commands in a Git Bash shell, typically inside the terminal tab in IntelliJ IDEA or in a Windows terminal tab.

Recently, I have started seeing odd/extra characters when I run box and when I run commands like box start

Here is what I see when I run box

Here is what I see when I run box start

I thought it was maybe an issue with Git Bash, but if I open a Git Bash window from Windows Explorer and run box, I see this

I should note that I tried this using other shells in Windows Terminal and it worked as expected. It seems to be an issue only when I use Git Bash in other windows/processes.

I realize this may be a fairly unique setup.

Can anyone shed some light on what is causing the extra characters and for colors not to be shown?

Those extra characters are the ANSI formatting escape sequences and it happens sometimes when the terminal isn’t in interactive mode. People usually get this inside of VSCode’s terminal tab and I think the solution is normally starting the shell with an interactive flag. I’ll ping in slack and ask anyone who ran into this before to chime in.

I don’t really use git-bash to run CommandBox but someone else I worked with was doing exactly that inside of VSCode and seeing the same thing a while back. I recreated it myself to give them a sanity check and in hopes of helping them debug and fix it.

I believe it was right around CommandBox 5.3… It ONLY happened in Windows and ONLY in git-bash. It definitely happened in git-bash inside of vscode terminals but I do not recall if it also happened in a stand-alone instance of git-bash (again, I do not use git-bash for CommandBox).

I was able to resolve it back then by replacing the jline 3.19 jar file in CommandBox with 3.18 (I’m about 90% sure on those jline versions. I just know I only had to go back one version from what was in CommandBox at the time). If being able to specifically use git-bash inside of an IDE is worth it to you, I suppose trying an older jline version is worth a shot.

It’s worth noting that I am currently on a fairly new install of Windows 10 right now, the latest version of CommandBox and, without any jline version changes. Git-bash in VSCode looks (mostly) fine for me right now. The “working” icons are question marks but all the color coding and everything else looks fine. I’m sure I could fix the font with minimal effort but, one more time, I just don’t use git-bash for CommandBox. I am, however, NOT using the latest “Git for Windows”. I am using 2.33.1 because SSH keys generated with the latest version of OpenSSL (which is now in newer version of Git for Windows) do not work with our bitbucket instance yet.

Good luck!


To be clear it is not just in my IDE this happens. It is in Windows Terminal…which I use almost exclusively.

That worked…and you got the jline versions correct.

1 Like

Downgrading Jline to 3.18.0 worked for me, however I only had the issue when calling box commands from a vscode task with the shell configured as

"shell": {
            "executable": "${env:ProgramFiles}/Git/usr/bin/bash.exe",
            "args": ["-c", "-l", "-i"]

jline 3.21.0 also appears to fix the issue
commandbox v5.4.2+00453

1 Like

FWIW, the next version of CommandBox will be using JLine 3.21. This must have been some regression in the 3.19 version. Sigh-- the posh life of herding Java dependencies all day :slight_smile: