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

Missing keystrokes when using System.console().readLine() #952

Open
rehand opened this issue Mar 13, 2024 · 2 comments
Open

Missing keystrokes when using System.console().readLine() #952

rehand opened this issue Mar 13, 2024 · 2 comments

Comments

@rehand
Copy link

rehand commented Mar 13, 2024

Hello,
I've the problem that when using System.console().readLine() is used at least twice in a row, starting with the second input/line always the first character is lost resp. read from the shell.

I've created a patch for Repl.java of the demo project to reproduce the issue.

When I'm doing two readLines and always type "test", the output is as follows:

JLine terminal: windows-vtp
groovy-repl> testkey
Input the first event: test
Input the second event (here the first character is lost): est
"testest"
groovy-repl> t

Originally I thought it's an issue of picocli, so I created a similar bug there but it seems to be an issue of jline3.

The issue affects only Windows, on Linux it works without problems. Also when using WSL2 works, so maybe it's an issue in combination with powershell and cmd.

readline.patch

@gnodet
Copy link
Member

gnodet commented Apr 18, 2024

I can't reproduce the issue with current master + cmd on windows 11....

@electronicboy
Copy link

I hope I'm not hijacking something here, but, this looks to be a mix of java 22 + cmd/powershell 5, I don't run windows so I can't go crazy with testing, however;

PaperMC/Paper#10405 (comment)

Seems to be caused by this JDK change. As a workaround, starting the server with -Djdk.console=java.base to revert to the old JDK behaviour fixes the issue. I would recommend just using PS7 though, its much nicer anyways.

suggests that PS7, or manually reverting from java console change mitigates this too

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

No branches or pull requests

3 participants