RFR: 8362116: System.in.read() etc. don't accept input once immediate Ctrl+D pressed in JShell
Jan Lahoda
jlahoda at openjdk.org
Mon Jul 14 12:54:16 UTC 2025
On Mon, 14 Jul 2025 12:48:27 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> When in JShell, doing:
>
> jshell> IO.readln();
> //Ctrl-D
> $1 ==> null
>
> jshell> IO.readln()
> $2 ==> null //no input allowed
>
>
> Where relying input from the main process to the remote/agent process, need to propagate `-1` as `-1` without close, which is what this PR is attempting to do.
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java line 1438:
> 1436: public Attributes enterRawMode() {
> 1437: Attributes res = super.enterRawMode();
> 1438: res.setControlChar(ControlChar.VEOF, 4);
This is to correctly recognize `4`/Ctrl-D in the input in tests. Note this terminal is supposed to only be used by tests.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26292#discussion_r2204860401
More information about the compiler-dev
mailing list