Skip to content
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

REPL does not show input (Windows) #9434

Open
scabug opened this Issue Aug 12, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Aug 12, 2015

After upgrading to Scala 2.11.7 on Windows, the REPL when started using sbt console does not display the user's input when typing anymore. Only after pressing ENTER, one can see the result of evaluating the input (but not the input itself).

I guess this problem is somehow related to [https://github.com/scala/scala/pull/4563], so I addded -Ydebug to scalacOptions. The output seems to confirm that the REPL cannot find the embedded JLine interpreter.

> console
[info] Starting scala interpreter...
[info]
Trying to instantiate a InteractiveReader from scala.tools.nsc.interpreter.jline
.InteractiveReader
Trying to instantiate a InteractiveReader from scala.tools.nsc.interpreter.jline
_embedded.InteractiveReader
All InteractiveReaders tried:
  - scala.tools.nsc.interpreter.jline.InteractiveReader --> java.lang.reflect.In
vocationTargetException
        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:62)
        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:45)
        java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$76(ILoop.scala:856)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1448/1176529533.apply(Unknown
Source)
        scala.tools.nsc.interpreter.ILoop.mkReader$1(ILoop.scala:862)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$80(ILoop.scala:866)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1447/1284017825.apply(Unknown
Source)
        scala.util.Try$.apply(Try.scala:211)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$79(ILoop.scala:866)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1446/1557843730.apply(Unknown
Source)
        scala.collection.immutable.Stream.map(Stream.scala:418)
        scala.tools.nsc.interpreter.ILoop.chooseReader(ILoop.scala:866)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$86(ILoop.scala:907)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$85(ILoop.scala:907)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1436/1142893085.apply$mcZ$sp(U
nknown Source)
        scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
        scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaC
lassLoader.scala:125)
        scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:902)
        scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:927)
        xsbt.ConsoleInterface.run(ConsoleInterface.scala:62)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:43)
        java.lang.reflect.Method.invoke(Method.java:497)
        sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
        sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:76)
        sbt.Console.sbt$Console$$console0$1(Console.scala:22)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala
:23)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
        sbt.Logger$$anon$4.apply(Logger.scala:85)
        sbt.TrapExit$App.run(TrapExit.scala:248)
        java.lang.Thread.run(Thread.java:745)

  - scala.tools.nsc.interpreter.jline_embedded.InteractiveReader --> java.lang.C
lassNotFoundException: scala.tools.nsc.interpreter.jline_embedded.InteractiveRea
der
        java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        java.lang.Class.forName0(Native Method)
        java.lang.Class.forName(Class.java:264)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$76(ILoop.scala:855)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1448/1176529533.apply(Unknown
Source)
        scala.tools.nsc.interpreter.ILoop.mkReader$1(ILoop.scala:862)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$80(ILoop.scala:866)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1447/1284017825.apply(Unknown
Source)
        scala.util.Try$.apply(Try.scala:211)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$79(ILoop.scala:866)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1446/1557843730.apply(Unknown
Source)
        scala.collection.immutable.Stream.map(Stream.scala:418)
        scala.collection.immutable.Stream.scala$collection$immutable$Stream$$$an
onfun$5(Stream.scala:418)
        scala.collection.immutable.Stream$$Lambda$1465/891606772.apply(Unknown S
ource)
        scala.collection.immutable.Stream$Cons.tail(Stream.scala:1187)
        scala.collection.immutable.Stream$Cons.tail(Stream.scala:1177)
        scala.collection.immutable.Stream.collect(Stream.scala:435)
        scala.tools.nsc.interpreter.ILoop.chooseReader(ILoop.scala:868)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$86(ILoop.scala:907)
        scala.tools.nsc.interpreter.ILoop.scala$tools$nsc$interpreter$ILoop$$$an
onfun$85(ILoop.scala:907)
        scala.tools.nsc.interpreter.ILoop$$Lambda$1436/1142893085.apply$mcZ$sp(U
nknown Source)
        scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
        scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaC
lassLoader.scala:125)
        scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:902)
        scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:927)
        xsbt.ConsoleInterface.run(ConsoleInterface.scala:62)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:62)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:43)
        java.lang.reflect.Method.invoke(Method.java:497)
        sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
        sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:76)
        sbt.Console.sbt$Console$$console0$1(Console.scala:22)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala
:23)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
        sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
        sbt.Logger$$anon$4.apply(Logger.scala:85)
        sbt.TrapExit$App.run(TrapExit.scala:248)
        java.lang.Thread.run(Thread.java:745)

What is odd is that the same behavior occurs when starting the REPL directy by running scala inside Cygwin, but not when running scala inside the Windows command line (although the debug output looks the same), whereas the problem occurs under both environments when the REPL is launched from within SBT using console.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 12, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9434?orig=1
Reporter: Michael Ummels (ummels)
Affected Versions: 2.11.7, 2.12.0-M1, 2.12.0-M2

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 14, 2015

@som-snytt said:
Just a quick download & trial on the old cygwin setup. I see echo.

$ scala
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 42
res0: Int = 42

scala> :quit

apm@halyard ~
$ scala -Ydebug
Trying to instantiate a InteractiveReader from scala.tools.nsc.interpreter.jline.InteractiveReader
Trying to instantiate a InteractiveReader from scala.tools.nsc.interpreter.jline_embedded.InteractiveReader
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.NoClassDefFoundError: Could not initialize class scala.tools.fusesource_embedded.jansi.internal.Kernel32
        at scala.tools.fusesource_embedded.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:50)
        at scala.tools.jline_embedded.WindowsTerminal.getConsoleMode(WindowsTerminal.java:204)
        at scala.tools.jline_embedded.WindowsTerminal.init(WindowsTerminal.java:82)
        at scala.tools.jline_embedded.TerminalFactory.create(TerminalFactory.java:101)
        at scala.tools.jline_embedded.TerminalFactory.get(TerminalFactory.java:158)
        at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:229)
        at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:221)
        at scala.tools.jline_embedded.console.ConsoleReader.<init>(ConsoleReader.java:209)
        at scala.tools.nsc.interpreter.jline_embedded.JLineConsoleReader.<init>(JLineReader.scala:61)
        at scala.tools.nsc.interpreter.jline_embedded.InteractiveReader.<init>(JLineReader.scala:33)

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 20, 2015

Michael Ummels (ummels) said (edited on Aug 20, 2015 4:43:07 PM UTC):
I just started Cygwin using cygwin.bat instead of running "Cygwin Terminal" from the Windows start menu, and indeed I see echo, so the error seems to depend on which shell or terminal you use.

Anyway, could you try runing sbt console in a project with scalaVersion set to 2.11.7? Because when I run the REPL from SBT, I don't see echo even on the regular Windows command line.

@scabug scabug added this to the Backlog milestone Apr 7, 2017

@davidcian

This comment has been minimized.

Copy link

davidcian commented Dec 16, 2018

I've got the same issue on Windows 10 Family (Version 1803, 17134.471). I'm using sbt 1.2.3, and Scala 2.12.6. When I run sbt inside a git bash console, it does not echo input to the CLI, although it does receive it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.