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

Rascal REPL does not work when run from git bash #1879

Open
PieterOlivier opened this issue Oct 29, 2023 · 3 comments
Open

Rascal REPL does not work when run from git bash #1879

PieterOlivier opened this issue Oct 29, 2023 · 3 comments
Labels

Comments

@PieterOlivier
Copy link
Contributor

PieterOlivier commented Oct 29, 2023

Describe the bug

When the Rascal repl is started from git bash it starts but it never accepts input.

To Reproduce

Start Rascal from git bash:

$ java -jar rascal-shell-stable.jar
Version: 0.33.8
INFO: detected |lib://rascal| at |jar+file:///C:/Users/pieter/rascal/rascal-shell-stable.jar!/|
rascal>

Input can be typed but it is ignored by the REPL. CPU spikes because of an endless loop. Here the root cause is discussed:
jline/jline2#245

jstack shows a similar stack trace compared to the one in the jline issue above.

Possible fixes
One of the solutions suggested there works partially:
When starting Rascal like this: java -Djline.terminal=jline.UnixTerminal -jar rascal-shell-stable.jar, Rascal no longer hangs. You can interact with the REPL. Unfortunately the cursor keys do not go through the command line history but instead navigate over the screen. So this is only a partial solution.

The final solution seems to be to upgrade from jline2 to jline3 but that is a non-trivial operation because of the API changes in jline3.

@JJWTimmer
Copy link
Contributor

I've seen this before with different programs. It has to do with how Git Bash works I think. If you prefix the command with winpty it starts working.

@PieterOlivier
Copy link
Contributor Author

Thanks @JJWTimmer, that trick works!

@DavyLandman
Copy link
Member

To reproduce it, I just installed git for windows inside a Windows Sandbox, the installer warns you about this issue.
image
there is also this experimental addition for this:
image
if I leave that disabled: I can indeed reproduce the problem. and running it with winpty indeed fixes it.

if you do choose to turn on that experimental flag, it works without winpty (as the tool tries to figure it out automatically).

in the end, we have to move to jline3, but like you already noted, that's not that trivial. but more than just this bug, we should move to jline3 at some point.

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

No branches or pull requests

3 participants