expose ugly windows hack
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sat, 17 Aug 2019 11:35:02 +0000 (06:35 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sat, 17 Aug 2019 11:35:02 +0000 (06:35 -0500)
src/jexer/TTerminalWindow.java

index 320c67a087364aac66e4e7c5be6215de7d30224d..2106cf0e8c1c48ca59d1efe39a6e155e911e059c 100644 (file)
@@ -296,6 +296,15 @@ public class TTerminalWindow extends TScrollableWindow
 
         this.closeOnExit = closeOnExit;
 
+        if (System.getProperty("jexer.TTerminal.shell") != null) {
+            String shell = System.getProperty("jexer.TTerminal.shell");
+            if (shell.trim().startsWith("ptypipe")) {
+                ptypipe = true;
+            }
+            spawnShell(shell.split("\\s+"));
+            return;
+        }
+
         String cmdShellWindows = "cmd.exe";
 
         // You cannot run a login shell in a bare Process interactively, due
@@ -559,8 +568,11 @@ public class TTerminalWindow extends TScrollableWindow
 
             // UGLY HACK TIME!  cmd.exe needs CRLF, not just CR, so if
             // this is kBEnter then also send kbCtrlJ.
-            if (System.getProperty("os.name").startsWith("Windows")) {
-                if (keypress.equals(kbEnter)) {
+            if (keypress.equals(kbEnter)) {
+                if (System.getProperty("os.name").startsWith("Windows")
+                    && (System.getProperty("jexer.TTerminal.cmdHack",
+                            "true").equals("true"))
+                ) {
                     emulator.addUserEvent(new TKeypressEvent(kbCtrlJ));
                 }
             }