# HG changeset patch # User jlahoda # Date 1476181995 -7200 # Node ID 7fc722354621d85c2f4b55c73ac71e15b212b348 # Parent e5ebda6a1a832f6a21d2dab2fe3d2dc358f591d4 8166890: JShell: locks forever when input is piped Summary: Only read cursor position if connected to a terminal. Reviewed-by: rfield, shinyafox diff -r e5ebda6a1a83 -r 7fc722354621 jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java Tue Oct 11 12:25:54 2016 +0200 +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java Tue Oct 11 12:33:15 2016 +0200 @@ -2339,7 +2339,7 @@ Stack pushBackChar = new Stack(); - if (terminal.isAnsiSupported()) { + if (terminal.isAnsiSupported() && System.console() != null) { //detect the prompt length by reading the cursor position from the terminal //the real prompt length could differ from the simple prompt length due to //use of escape sequences: