-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala REPL ignores redirected standard input on Windows #7703
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7703?orig=1 |
@harrah said: |
Tony Sloane (asloane) said: BTW, on Mac OS X adding that option makes things worse: the REPL still executes the expressions from the file, but doesn't echo them and goes into an infinite prompt-printing loop at the end of the file. |
@harrah said: |
Tony Sloane (asloane) said: I will join the jline2 list and ask if this is expected behaviour. |
@harrah said: |
Tony Sloane (asloane) said: ConsoleReader console = new ConsoleReader(System.in, System.out, new TerminalSupport(true) {}); seems to be a workaround for this input redirection problem when using JLine 2.11. At least, with this change the jline example program now properly accepts stdin redirection on Windows 7. How do you feel about trying this change in the scala REPL and in sbt? |
@harrah said: |
Tony Sloane (asloane) said: |
Tony Sloane (asloane) said: |
Tony Sloane (asloane) said: |
@harrah said: |
@retronym said: |
Tony Sloane (asloane) said: |
On Unix-like systems (including Mac OS X), the Scala REPL ("scala" command) can be run from the shell by redirecting input in from a file, as in:
scala < Test.scala
The contents of
Test.scala
are processed by the REPL as if they were typed interactively. Once the contents of the file have been processed, the REPL exits.This mode of using the REPL is used by my Scala Worksheet plugin for Sublime Text 3 (https://bitbucket.org/inkytonik/scalaworksheet). The output of the REPL is captured and used to associated input code with the output that it produces.
Unfortunately, this mode of execution of the REPL does not work on Windows 7, even though the Windows CMD shell supports input redirection. Anecdotally from plugin users it doesn't work on other versions of Windows too.
I have tested 2.11.0-M4 but the problem occurs in 2.10.2, 2.9.2 and the latest nightly as well.
The observed behaviour on Windows 7 is that the REPL starts up as normal, but it behaves as if nothing was redirected in. I.e., it just goes to the prompt and waits for interactive input.
I'm not sure whether there is any specification of what the REPL should do in this circumstance, but it would be particularly useful for my plugin if it behaved on Windows the way it does on other systems. As we stand, the plugin is not usable on Windows so it's a blocker for me.
The text was updated successfully, but these errors were encountered: