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
weird interaction between repl and console input #3442
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3442?orig=1
|
@eengbrec said: |
@eengbrec said: |
@paulp said: Console.withIn(System.in) { Console.readLine("Enter stuff:") } |
@eengbrec said: JRuby's repl succeeds at echoing characters that are going into a BufferedReader, but fails the same as Jython and Scala with java.io.Console. I don't think this is high priority, Merely mildly annoying, and mostly annoying because I didn't know of the limitation. I won't get any heartburn if it's marked as wontfix or given a very low priority. |
Steven Bethard (bethard) said: scala> Console.withIn(System.in) {System.console.readLine("username: ")}
username: res10: java.lang.String = a
scala> bcde This matters less for |
@paulp said:
That's because that's not the code which was given.
That's the code which was given.
What you're supposed to do, if that is not a rhetorical question, is fix it and submit a patch. It's not like the ticket was closed "everything's fine". |
Steven Bethard (bethard) said: Anyway, here's a workaround (using jline which appears to be included by scala already): scala> new jline.ConsoleReader().readLine('*')
******
res0: java.lang.String = abdefg |
@gourlaysama said: scala> repl.in.readLine("enter something: ")
enter something: hello world
res0: String = hello world If only that readLine method was used as the default readLine in the REPL... |
Attempting to use java.io.Console to read a password throws the repl into weirdness and only reads in a single character:
Also, when calls to the regular readLine method are made, the characters are not echoed to the screen:
Both of these work as expected if run as a script instead of from the repl. Scripts are attached.
The text was updated successfully, but these errors were encountered: