Scala Programming Language
  1. Scala Programming Language
  2. SI-4945

"scala -i" hangs, cannot preload file before starting the REPL

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: Scala 2.10.0-M6
    • Component/s: Repl / Interpreter
    • Labels:
    • Environment:

      Scala 2.9.1.RC4 (OpenJDK 64-Bit Server VM, Java 1.6.0_22) on openSUSE 11.4 (x86_64)

      Description

      In Scala 2.9.1.RC4, the "-i 'file'" command line argument (which is supposed to preload a file before starting the REPL) does not work. For example, consider a file "preload.scala" containing just 'println("Hello world.")'. Scala 2.9.1.RC4 says "Loading preload.scala..." and never yields the prompt. It hangs indefinitely. Conversely, the "-i" command line arguments works as expected in Scala 2.9.0.1, yielding the prompt after printing "Hello world."

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          That's unfortunate. As a workaround, supply command line option -Yrepl-sync.

          Show
          Paul Phillips added a comment - That's unfortunate. As a workaround, supply command line option -Yrepl-sync.
          Hide
          Hendy Irawan added a comment -

          Thanks Paul ! Workaround works!

          Still happens on 2.9.1

          Show
          Hendy Irawan added a comment - Thanks Paul ! Workaround works! Still happens on 2.9.1
          Hide
          Paul Phillips added a comment -

          This seems to have acquired even more breakage.

          scala3 -Yrepl-sync -i bip.scala 
          Loading bip.scala...
          bad option: '-i:bip.scala'
          
          Show
          Paul Phillips added a comment - This seems to have acquired even more breakage. scala3 -Yrepl-sync -i bip.scala Loading bip.scala... bad option: '-i:bip.scala'
          Show
          Adriaan Moors added a comment - https://github.com/scala/scala/pull/1070
          Hide
          Hendy Irawan added a comment -

          Thank you !!

          Show
          Hendy Irawan added a comment - Thank you !!
          Hide
          Ryan Hendrickson added a comment - - edited

          I'm still seeing the hang on 2.10.0, unless I supply -Yrepl-sync.

          Although hold up, I'm running the REPL by calling ILoop directly, not by running the scala shell script, and I see that your fix for this involves just adding that option in MainGenericRunner, which I bypass. Sorry about that; I guess this is just one of the sharp corners when playing with internal APIs.

          Show
          Ryan Hendrickson added a comment - - edited I'm still seeing the hang on 2.10.0, unless I supply -Yrepl-sync. Although hold up, I'm running the REPL by calling ILoop directly, not by running the scala shell script, and I see that your fix for this involves just adding that option in MainGenericRunner, which I bypass. Sorry about that; I guess this is just one of the sharp corners when playing with internal APIs.

            People

            • Assignee:
              Paul Phillips
              Reporter:
              David B. Dahl
            • Votes:
              6 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development