Skip to content

Commit

Permalink
Update SimpleIO.java
Browse files Browse the repository at this point in the history
  • Loading branch information
JimLaskey committed Mar 12, 2024
1 parent 19e559c commit a674dba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/java.base/share/classes/java/io/SimpleIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public static String input(String prompt) throws UncheckedIOException {
if (console != null) {
return console.readLine(prompt);
} else {
// read from System.in, but don't prompt on System.out
try {
System.out.print(prompt);
return stdinReader.readLine();
} catch (IOException e) {
throw new UncheckedIOException(e);
Expand All @@ -139,9 +139,7 @@ public static String input(String prompt) throws UncheckedIOException {
private static final BufferedReader stdinReader;

static {
var con = System.console();
// if a console is not connected to a terminal, we don't use it
console = con != null && con.isTerminal() ? con : null;
console = System.console();
if (console == null) {
Charset charset;
try {
Expand Down

0 comments on commit a674dba

Please sign in to comment.