git: openjdk/jdk-sandbox: JDK-8305457-branch: Use console if present, prompt and read if not

Pavel Rappo prappo at openjdk.org
Thu Feb 8 20:01:59 UTC 2024


Changeset: e590b00c
Author:    Pavel Rappo <prappo at openjdk.org>
Date:      2024-02-08 20:01:08 +0000
URL:       https://git.openjdk.org/jdk-sandbox/commit/e590b00c6482c6bd769558926bc66d60dbee48ea

Use console if present, prompt and read if not

As of today, we cannot reliably say if the console represents a terminal
or not. Even if it is not, it can still be used for interaction and thus
prompt would be expected; for example in some REPLs or IDE "Run" window.

The decision is to delegate to console if it is present, and if it is
not, prompt unconditionally on stdout then read from stdin. This means
that in some cases there will be unexpected prompts; for example, if
stdin is redirected.

! src/java.base/share/classes/java/io/SimpleIO.java
! test/jdk/java/io/SimpleIO/SimpleIO.java



More information about the jdk-sandbox-changes mailing list