Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.19.0 Regression - Escape sequences are printed when using Git Bash in Windows Terminal #693

Closed
ryanhinton opened this issue Sep 2, 2021 · 22 comments · Fixed by #704
Closed
Labels
Milestone

Comments

@ryanhinton
Copy link

ryanhinton commented Sep 2, 2021

jline version 3.18.0 works, but 3.19.0 and 3.20.0 prints out raw unprocessed ANSI sequences on Git Bash from Git For Windows version 2.33.0.2-64-bit.

Version 3.19.0 and higher
image

Version 3.18.0
image

@ryanhinton ryanhinton changed the title Escape sequences are printed when using Git Bash 3.19.0 Regression - Escape sequences are printed when using Git Bash Sep 2, 2021
@mvmn
Copy link

mvmn commented Sep 10, 2021

Same here. Output is terribly broken in cygwin as well (CYGWIN_NT-10.0 DESKTOP-B07NHJ5 3.2.0(0.340/5/3) 2021-03-29 08:42 x86_64 Cygwin).

@mvmn
Copy link

mvmn commented Sep 10, 2021

Seems to be caused by this change:
2ec403f

Reverting this commit fixes the issue locally (though requires some conflict resolution)

@mvmn
Copy link

mvmn commented Sep 10, 2021

Seems to be caused by #669

@mattirn
Copy link
Collaborator

mattirn commented Sep 11, 2021

@ryanhinton and @mvmn, please could you check if the pull request #670 fixes your problem.

@bdw429s
Copy link
Contributor

bdw429s commented Sep 11, 2021

@mvmn Excellent work tracking down the source of the issue. @mattirn Is there a snapshot build somewhere with that pull, or do I need to build it myself to test?

@mvmn
Copy link

mvmn commented Sep 11, 2021

@mattirn , commented in #669 - the PR 670 fixes it for me.

@bdw429s
Copy link
Contributor

bdw429s commented Sep 13, 2021

@ryanhinton I have built the code on the pull and sent it to you as a jar in our Slack thread for you to test.

@ryanhinton
Copy link
Author

Thank you for looking into this @mvmn and @bdw429s!

I replaced the older jar file with the snapshot jar derived from this pull request and tested but still receive the escape characters. I made sure the older jline files were removed as well. Moreover, I also renamed it as jline-3.20.0.jar just to make sure it wasn't possibly an issue with the word 'SNAPSHOT' in the filename or that the code does not look for versions beyond 3.20.0 just yet. When I revert to using jline 3.18.0 jar, it looks good again.

@mvmn
Copy link

mvmn commented Sep 14, 2021

Hmm, weird. I've checked out and built locally the https://github.com/mattirn/jline3/tree/cygwin-issue , and it worked fine for me provided that I supply jansi or jna as parameter when running jline-repl.sh.

Did you try with jansi or jna parameter, @ryanhinton ?
Also is it possible that other JARs are affected?

When you run jline-repl.sh, what does it show in classpath output? Usually when it starts it outputs the classpath.

@ryanhinton
Copy link
Author

@mvmn Is there a difference between Cygwin and Git Bash (MINGW64)? Git bash is what I'm using. Maybe the two CLIs have the same issue, but have to be resolved differently. I'm not versed in Java or Jline well enough to be able to test in the manner you have mentioned, unfortunately. Maybe I can attempt to follow an example, if that's possible. I do know that I removed previous versions of jline jars and used the snapshot version of the jar, but it did not resolve the problem for Git Bash, unfortunately.

@bdw429s
Copy link
Contributor

bdw429s commented Sep 15, 2021

@mvmn If you wanted to try the same tool Ryan is using, you can grab box.exe from here
https://www.ortussolutions.com/products/commandbox#download
It is a CLI/REPL/console app written in CFML but runs on the JVM and bundles JLine for the console interaction. Here is the relevant integration code:
https://github.com/Ortus-Solutions/commandbox/blob/development/src/cfml/system/util/ReaderFactory.cfc#L82-L116

Generally speaking, the tool doesn't do anything special for one terminal or another. It relies on JLine to detect and do what it needs whether on Mac, Linux, or Windows and whatever array of Terminal apps that can be found on those OS's.

@mvmn
Copy link

mvmn commented Sep 16, 2021

Is there a difference between Cygwin and Git Bash (MINGW64)?

I suppose there is, I remember seeing some checks like "if(cygwin)" in the code.
I'll check with GitBash later today.

@mvmn
Copy link

mvmn commented Sep 16, 2021

P.S. Tested with GitBash - jline-repl works fine with the fix, just like in CygWin.
Will try the commandbox later.

@mvmn
Copy link

mvmn commented Sep 16, 2021

Downloaded commandbox-win-5.4.0, unpacked box.exe and run it in GitBash - seems to be working just fine ¯\_(ツ)_/¯

@ryanhinton
Copy link
Author

ryanhinton commented Sep 16, 2021

@mvmn, thank you for testing this! Obviously, I was puzzled how this was working for you. I found the fault of this but never knew that outside factors would interfere with Git Bash... until you said it works. So, I am using Windows Terminal which I thought was just executing Git Bash, but it is actually the reason for why it's not working somehow. My setup is that I open Windows Terminal in which I added Git Bash as an option to open within Windows Terminal. Git Bash doesn't appear any different inside Windows Terminal than running Git Bash outright, but there is apparently other things happening when Git Bash is running within Windows Terminal. When I execute Git Bash by itself, it works. When I attempt to run Git Bash from Windows Terminal, the characters get messed up for jline versions 3.19.0 and higher.

In case you are interested, this is my setup for Git Bash in Windows Terminal.
image

@ryanhinton
Copy link
Author

I see that I am sitting on Windows Terminal version 1.9 and see that the latest version of Windows Terminal is 1.10. I'm going to update Windows Terminal to see if it helps at all.

@ryanhinton
Copy link
Author

ryanhinton commented Sep 16, 2021

I updated Windows Terminal to version 1.10, but the problem still remains when using Git Bash within Windows Terminal. I attempted all of the jline jar versions from 3.18.0 and above with the results in the screenshot. 3.18.0 is still the only one that works.

image

@ryanhinton ryanhinton changed the title 3.19.0 Regression - Escape sequences are printed when using Git Bash 3.19.0 Regression - Escape sequences are printed when using Git Bash in Windows Terminal Sep 16, 2021
@ryanhinton
Copy link
Author

@ryanhinton and @mvmn, please could you check if the pull request #670 fixes your problem.
Hi @mattirn, unfortunately, PR #670 does not seem to work in my case when using Git Bash within Windows Terminal. Please see my screenshot in my previous comment.

@mattirn
Copy link
Collaborator

mattirn commented Sep 24, 2021

@ryanhinton and @mvmn, please could you check if the pull request #704 fixes your problem. I was able to reproduce the problem and for me everything seems to work correctly now. Anyway I would appreciate if you could double check.

@mvmn
Copy link

mvmn commented Sep 24, 2021

@mattirn , for me PR 704 works good, just as well as PR 670 did.

@ryanhinton
Copy link
Author

ryanhinton commented Sep 26, 2021

@mattirn, PR 704 is working nicely with Git Bash inside Windows Terminal! Thank you very much!

@mattirn mattirn added this to the 3.20.1 milestone Sep 27, 2021
@mattirn mattirn added the bug label Sep 27, 2021
mattirn added a commit that referenced this issue Sep 27, 2021
@bdw429s
Copy link
Contributor

bdw429s commented Sep 27, 2021

Excellent work, guys! I'll include this new version of JLine in the next version of CommandBox as soon as it hits a stable release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants