Closed
Description
How to reproduce: Add a line to HelloWorld#main
that makes it fail (e.g. throw new Exception("foo")
).
$ sbt
sbt:Scala.js> helloworld2_12/run
[info] Running helloworld.HelloWorld. Hit any key to interrupt.
scala-js/examples/helloworld/.2.12/target/scala-2.12/helloworld-fastopt/main.js:626
throw $m_sjsr_package$().unwrapJavaScriptException__jl_Throwable__O($ct_jl_Exception__T__(new $c_jl_Exception(), "foo"))
^
java.lang.Exception: foo
at ...
[error] org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
[error] at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:186)
[error] (helloworld2_12 / Compile / run) org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
[error] Total time: 11 s, completed Dec 16, 2020, 8:46:05 PM
sbt:Scala.js> helloworld2_12/run
[info] Running helloworld.HelloWorld. Hit any key to interrupt.
[error] org.scalajs.jsenv.ExternalJSRun$ClosedException: Termination was requested by user
[error] at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:184)
[error] (helloworld2_12 / Compile / run) org.scalajs.jsenv.ExternalJSRun$ClosedException: Termination was requested by user
[error] Total time: 1 s, completed Dec 16, 2020, 8:46:28 PM
This does not occur all the time (likely a race condition). The org.scalajs.jsenv.ExternalJSRun$ClosedException
gets thrown if JSRun#close()
is called before the JSEnv run terminates.
This is likely caused by close()
here being called too early:
scala-js/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/Run.scala
Lines 44 to 52 in eba131d