changeset 1413:37a9addb8c8d

8135151: jjs should work in cygwin environment Reviewed-by: attila, hannesw
author sundar
date Mon, 07 Sep 2015 20:07:03 +0530
parents 0ee4c3b61e45
children 330ddba6ffc4
files src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java	Mon Sep 07 11:11:41 2015 +0200
+++ b/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;
+    }
 }