-
Notifications
You must be signed in to change notification settings - Fork 218
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
LineReader.readLine() botches lines if stdin is redirected #899
Comments
I may be wrong, but JLine aims to follow the terminal settings. On unix systems, the input is controlled by the input flags returned by
Those are explained at https://man7.org/linux/man-pages/man3/termios.3.html I don't think there's an easy way to simply handle |
With the PR #900, it should be possible normalize EOL behaviour by using the following lines just after the terminal is created:
@pavelrappo could you double check if that would work for you ? |
Thanks for the suggestion. A colleague of mine, @naotoj, might look into this soon. I just wanted to understand if the behaviour I described in that OpenJDK bug was expected. Even if, for whatever reason, your suggestion doesn't pan out, as a non-expert, I assume that OpenJDK could always check if JLine is actually dealing with redirection rather than TTY. If it does, we could simulate |
That won't work, as JLine kinda ignores the given streams when building a system terminal and goes straight to the file descriptors. However, the JDK assumption that all line endings should be treated the same is, imho, a bit weird. That's a bit specific to the |
Why not? Perhaps I was unclear. What I meant was this: if
I don't know this for sure, so the following is my speculation. Input is different from output. If you output data from Java runtime, you might want to do it according to your or other's system customs. Hence,
|
Not sure to understand. I thought the problem was when using the JLine console, i.e. mainly when |
Is this (see title) expected? For concrete examples, see this bug against OpenJDK, where
System.console()
is implemented using JLine: https://bugs.openjdk.org/browse/JDK-8319545The text was updated successfully, but these errors were encountered: