changeset 41476:7fc722354621

8166890: JShell: locks forever when input is piped Summary: Only read cursor position if connected to a terminal. Reviewed-by: rfield, shinyafox
author jlahoda
date Tue, 11 Oct 2016 12:33:15 +0200
parents e5ebda6a1a83
children 702287a26ac8
files jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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<Character> pushBackChar = new Stack<Character>();
 
-            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: