@@ -98,40 +98,35 @@ trait RunnerOrchestration {
9898
9999 def readLine (): String =
100100 stdout.readLine() match
101- case s " Listening for transport dt_socket at address: $port" =>
102- throw new IOException (
103- s " Unexpected transport dt_socket message. " +
104- " The port is going to be lost and no debugger will be able to connect."
105- )
106- case line => line
101+ case s " Listening for transport dt_socket at address: $port" =>
102+ throw IOException (
103+ " Unexpected transport dt_socket message." +
104+ " The port is going to be lost and no debugger will be able to connect."
105+ )
106+ case line => line
107107
108108 def printLine (line : String ): Unit = stdin.println(line)
109109
110110 def getJdiPort (): Int =
111111 stdout.readLine() match
112- case s " Listening for transport dt_socket at address: $port" => port.toInt
113- case line => throw new IOException (s " Failed getting JDI port of child JVM: got $line" )
112+ case s " Listening for transport dt_socket at address: $port" => port.toInt
113+ case line => throw IOException (s " Failed getting JDI port of child JVM: got $line" )
114114
115- export p .{exitValue , isAlive , destroy }
115+ def isAlive : Boolean = p.isAlive // export p.isAlive sans parens
116+
117+ export p .{exitValue , destroy }
116118 end RunnerProcess
117119
118120 private class Runner (private var process : RunnerProcess ):
119- /** Checks if `process` is still alive
120- *
121- * When `process.exitValue()` is called on an active process the caught
122- * exception is thrown. As such we can know if the subprocess exited or
123- * not.
124- */
125- def isAlive : Boolean =
126- try { process.exitValue(); false }
127- catch case _ : IllegalThreadStateException => true
128-
129- /** Destroys the underlying process and kills IO streams */
121+ /** Checks whether the underlying process is still alive. */
122+ def isAlive : Boolean = process.isAlive
123+
124+ /** Destroys the underlying process and kills IO streams. */
130125 def kill (): Unit =
131126 if (process ne null ) process.destroy()
132127 process = null
133128
134- /** Blocks less than `maxDuration` while running `Test.main` from `dir` */
129+ /** Blocks less than `maxDuration` while running `Test.main` from `dir`. */
135130 def runMain (classPath : String ): Status =
136131 assert(process ne null , " Runner was killed and then reused without setting a new process" )
137132 awaitStatusOrRespawn(startMain(classPath))
@@ -172,7 +167,7 @@ trait RunnerOrchestration {
172167 sb.append(childOutput).append(System .lineSeparator)
173168 childOutput = process.readLine()
174169
175- if process. isAlive() && childOutput != null then Success (sb.toString)
170+ if isAlive && childOutput != null then Success (sb.toString)
176171 else Failure (sb.toString)
177172 end startMain
178173
@@ -198,7 +193,7 @@ trait RunnerOrchestration {
198193 * scala library.
199194 */
200195 private def createProcess (): RunnerProcess =
201- val url = classOf [ChildJVMMain ].getProtectionDomain.getCodeSource.getLocation
196+ val url = classOf [ChildJVMMain . type ].getProtectionDomain.getCodeSource.getLocation
202197 val cp = Paths .get(url.toURI).toString + JFile .pathSeparator + Properties .scalaLibrary
203198 val javaBin = Paths .get(sys.props(" java.home" ), " bin" , " java" ).toString
204199 val args = Seq (" -Dfile.encoding=UTF-8" , " -Duser.language=en" , " -Duser.country=US" , " -Xmx1g" , " -cp" , cp) ++
0 commit comments