diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-18 10:03:12 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-18 10:03:12 -0700 |
commit | 350a3115afca590bee6311dbed4a657fe9cca375 (patch) | |
tree | 1a94f063491826eef5487e283e133d4e5e48ff16 /scalajslib/src | |
parent | d759fea899b1889d64bacdcee6a4fdd9dd8f1417 (diff) | |
download | mill-350a3115afca590bee6311dbed4a657fe9cca375.tar.gz mill-350a3115afca590bee6311dbed4a657fe9cca375.tar.bz2 mill-350a3115afca590bee6311dbed4a657fe9cca375.zip |
Properly close Scala.js test adapters when done, after letting the IO drain properly
Diffstat (limited to 'scalajslib/src')
-rw-r--r-- | scalajslib/src/mill/scalajslib/ScalaJSBridge.scala | 4 | ||||
-rw-r--r-- | scalajslib/src/mill/scalajslib/ScalaJSModule.scala | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/scalajslib/src/mill/scalajslib/ScalaJSBridge.scala b/scalajslib/src/mill/scalajslib/ScalaJSBridge.scala index e5952291..20e6542c 100644 --- a/scalajslib/src/mill/scalajslib/ScalaJSBridge.scala +++ b/scalajslib/src/mill/scalajslib/ScalaJSBridge.scala @@ -57,7 +57,7 @@ class ScalaJSWorker { def getFramework(toolsClasspath: Agg[Path], config: NodeJSConfig, frameworkName: String, - linkedFile: File): sbt.testing.Framework = { + linkedFile: File): (() => Unit, sbt.testing.Framework) = { bridge(toolsClasspath).getFramework(config, frameworkName, linkedFile) } @@ -74,7 +74,7 @@ trait ScalaJSBridge { def getFramework(config: NodeJSConfig, frameworkName: String, - linkedFile: File): sbt.testing.Framework + linkedFile: File): (() => Unit, sbt.testing.Framework) } diff --git a/scalajslib/src/mill/scalajslib/ScalaJSModule.scala b/scalajslib/src/mill/scalajslib/ScalaJSModule.scala index 4f932e1e..948b13df 100644 --- a/scalajslib/src/mill/scalajslib/ScalaJSModule.scala +++ b/scalajslib/src/mill/scalajslib/ScalaJSModule.scala @@ -184,7 +184,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { override def testLocal(args: String*) = T.command { test(args:_*) } override def test(args: String*) = T.command { - val framework = mill.scalajslib.ScalaJSBridge.scalaJSBridge().getFramework( + val (close, framework) = mill.scalajslib.ScalaJSBridge.scalaJSBridge().getFramework( toolsClasspath().map(_.path), nodeJSConfig(), testFrameworks().head, @@ -199,7 +199,13 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { Agg(compile().classes.path), args ) - TestModule.handleResults(doneMsg, results) + val res = TestModule.handleResults(doneMsg, results) + // Hack to try and let the Node.js subprocess finish streaming it's stdout + // to the JVM. Without this, the stdout can still be streaming when `close()` + // is called, and some of the output is dropped onto the floor. + Thread.sleep(100) + close() + res } } |