Tony Sloane avatar Tony Sloane committed db46e30

Set jline.DWindowsTerminal.directConsole system property to false, makes stdin redirection work on Win 7

Comments (0)

Files changed (1)

     # Run the input code through the REPL
     def runCode (self, edit, window):
-        # Make the shell command
+        # Start to make the shell command: command and class path
         cmd = 'scala'
         classpath = self.makeClassPath ()
         if classpath:
             cmd += ' -classpath'
             cmd += ' ' + classpath
+        # On Windows the JLine2 library used by the scala REPL ignores stdin
+        # redirection. This is due to it using a JNI solution on that platform.
+        # Setting this system property turns the JNI solution off and redirection
+        # works.
+        if == 'nt':
+            cmd += ' -Djline.WindowsTerminal.directConsole=false'
+        # Direct the file into stdin
         cmd += ' <' + self.input_file_name
-        # Run the cmd
+        # Command is complete, run it
         window.run_command ('run_scala', {
             'cmd': cmd,
             'output_file_name': self.view.file_name ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.