Commits

Tony Sloane committed db46e30

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

Comments (0)

Files changed (1)

ScalaWorksheet.py

 
     # 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 os.name == '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 ()