--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Mon Sep 07 11:11:41 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Mon Sep 07 20:07:03 2015 +0530
@@ -49,9 +49,9 @@
Console(final InputStream cmdin, final PrintStream cmdout, final File historyFile,
final Completer completer) throws IOException {
+ TerminalFactory.registerFlavor(Flavor.WINDOWS, isCygwin()? JJSUnixTerminal::new : JJSWindowsTerminal::new);
+ TerminalFactory.registerFlavor(Flavor.UNIX, JJSUnixTerminal::new);
in = new ConsoleReader(cmdin, cmdout);
- TerminalFactory.registerFlavor(Flavor.WINDOWS, JJSWindowsTerminal :: new);
- TerminalFactory.registerFlavor(Flavor.UNIX, JJSUnixTerminal :: new);
in.setExpandEvents(false);
in.setHandleUserInterrupt(true);
in.setBellEnabled(true);
@@ -134,4 +134,8 @@
setAnsiSupported(false);
}
}
+
+ private static boolean isCygwin() {
+ return System.getenv("SHELL") != null;
+ }
}