summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-22 19:33:51 +0000
committerPaul Phillips <paulp@improving.org>2011-02-22 19:33:51 +0000
commit6961f663710ac4b61b4f6ef6dd3a34ff9ff7ca00 (patch)
treedf4466c3ba8a91f1be915b65f9eccb0591096551 /src/compiler
parent8aaca8c135d6dcbc56b9bba92cd95ea5ea0a7e3c (diff)
downloadscala-6961f663710ac4b61b4f6ef6dd3a34ff9ff7ca00.tar.gz
scala-6961f663710ac4b61b4f6ef6dd3a34ff9ff7ca00.tar.bz2
scala-6961f663710ac4b61b4f6ef6dd3a34ff9ff7ca00.zip
Added daemonized() method to ProcessBuilder so ...
Added daemonized() method to ProcessBuilder so I can do things like start fsc without the jvm failing to exit. More logging to fsc. scala -e '5' now works again. Closes #4254, review by harrah.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/CompileClient.scala13
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala4
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala6
-rw-r--r--src/compiler/scala/tools/util/SocketServer.scala2
4 files changed, 16 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index 752e9a7930..d1b1f751ef 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -19,6 +19,10 @@ class StandardCompileClient extends HasCompileSocket {
val versionMsg = "Fast " + Properties.versionMsg
var verbose = false
+ def logVerbose(msg: String) =
+ if (verbose)
+ Console println msg
+
def main0(argsIn: Array[String]): Int = {
// TODO: put -J -and -D options back. Right now they are lost
// because bash parses them out and they don't arrive.
@@ -32,10 +36,11 @@ class StandardCompileClient extends HasCompileSocket {
Console println versionMsg
return 0
}
- if (verbose) {
- Console println fscArgs.mkString("[Given arguments: ", " ", "]")
- Console println vmArgs.mkString("[VM arguments: ", " ", "]")
- }
+
+ logVerbose(versionMsg)
+ logVerbose(fscArgs.mkString("[Given arguments: ", " ", "]"))
+ logVerbose(vmArgs.mkString("[VM arguments: ", " ", "]"))
+
val socket =
if (settings.server.value == "") compileSocket.getOrCreateSocket(vmArgs mkString " ", !shutdown)
else Some(compileSocket.getSocket(settings.server.value))
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index e33545d3c9..b6e9ab33d5 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -119,7 +119,8 @@ class StandardCompileServer extends SocketServer {
}
def isCompilerReusable: Boolean = {
if (compiler == null) {
- logVerbose("[Creating compiler instance for compile server.]")
+ logVerbose("[Creating new instance for compile server.]")
+ logVerbose("[Compiler version: " + Properties.versionString + ".]")
return false
}
val unequal = unequalSettings(command.settings, compiler.settings)
@@ -175,7 +176,6 @@ object CompileServer extends StandardCompileServer {
redirect(System.setErr, "scala-compile-server-err.log")
System.err.println("...starting server on socket "+port+"...")
System.err.flush()
-
compileSocket.setPort(port)
run()
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 4f71a3da87..c75c6d0f22 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -110,7 +110,7 @@ class CompileSocket {
private def startNewServer(vmArgs: String) = {
val cmd = serverCommand(vmArgs split " " toSeq)
info("[Executing command: %s]" format cmd)
- cmd.run()
+ cmd.daemonized().run()
}
/** The port identification file */
@@ -132,8 +132,10 @@ class CompileSocket {
var attempts = 0
var port = pollPort()
- if (port < 0)
+ if (port < 0) {
+ info("No compile server running: starting one with args '" + vmArgs + "'")
startNewServer(vmArgs)
+ }
while (port < 0 && attempts < MaxAttempts) {
attempts += 1
diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala
index 57ebf96656..0094333402 100644
--- a/src/compiler/scala/tools/util/SocketServer.scala
+++ b/src/compiler/scala/tools/util/SocketServer.scala
@@ -40,7 +40,7 @@ abstract class SocketServer {
def fscIdleMillis = fscIdleMinutes * 60 * 1000
def shutdown: Boolean
- def session()
+ def session(): Unit
var out: PrintWriter = _
var in: BufferedReader = _