Closed rehand closed 2 months ago
Is this a picocli issue or a JLine issue?
Could also be a JLine issue, but in general interactive options are broken when using "picocli-shell-jline3"
I've tried to recreate the issue with plain JLine3 and it also happens there, but only if System.console() is used for input. When using the lineReader it doesn't happen.
I've tried to recreate the issue with plain JLine3 and it also happens there, but only if System.console() is used for input. When using the lineReader it doesn't happen.
The lineReader
is a JLine class?
It may be tricky to change picocli to use a JLine class instead of System.console()
for interactive options.
Yes, it's org.jline.reader.LineReader
I'm using now the following workaround: If line reader is available (through CDI) then I'm using line reader, if not, a fallback to System.console() is implemented.
In your workaround, you stopped using picocli interactive options?
I am wondering if there is anything I can/should do for this issue. One idea is to update the documentation to tell users that interactive options cannot be combined with JLine3. Or, if there is a workaround, to explain this workaround in the picocli documentation for interactive options. What do you think?
I do use interactive options but I'm resolving them myself via a mixin and then by using the LineReader from JLine.
I also reported the bug to jline3
Hello, I've the problem that if one command has more than one interactive input (e.g. due to interactive options or using System.console().readLine() in the option) that starting with the second input the first entered character is captured by the console (from jline3) itself, but not by the input reader. This is very annoying and confusing when entering passwords (echo = false) because then you don't notice that the first character is lost.
I've added a demo project which reproduces the issue.
The issue occurs only on Windows, I wasn't able to reproduce it on Linux. It also works on Windows using Ubuntu Bash via WSL2.
My example has two interactive options and it also asks via "System.console().readLine()". For each option I'm typing "test". After entering all 4 options you can see, that jline3 captured 3 times "t", so the missing characters.
I'd appreciate any help on this issue. It looks related to 1139
testJline3.zip