diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-24 15:35:24 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-24 17:13:03 -0800 |
commit | 139afd965ea072f8216b56126fb08dc8a44ebac4 (patch) | |
tree | e0e54b719479cf5d0be311887433a4e8d4d48c0f /clientserver | |
parent | e76a4eda93e96e6817ab4f337f567fd325efe545 (diff) | |
download | mill-139afd965ea072f8216b56126fb08dc8a44ebac4.tar.gz mill-139afd965ea072f8216b56126fb08dc8a44ebac4.tar.bz2 mill-139afd965ea072f8216b56126fb08dc8a44ebac4.zip |
Implement `-i` flag to allow interactive usage
Diffstat (limited to 'clientserver')
-rw-r--r-- | clientserver/src/mill/clientserver/Client.scala | 7 | ||||
-rw-r--r-- | clientserver/src/mill/clientserver/Server.scala | 9 |
2 files changed, 1 insertions, 15 deletions
diff --git a/clientserver/src/mill/clientserver/Client.scala b/clientserver/src/mill/clientserver/Client.scala index b7a39cb2..1a4b1539 100644 --- a/clientserver/src/mill/clientserver/Client.scala +++ b/clientserver/src/mill/clientserver/Client.scala @@ -34,17 +34,14 @@ class Client(lockBase: String, stdout: OutputStream, stderr: OutputStream) extends ClientServer(lockBase){ def run(args: Array[String]) = { - println("Client Run") val f = new FileOutputStream(runFile) ClientServer.writeArgs(System.console() != null, args, f) f.close() if (locks.processLock.probe()) initServer() while(locks.processLock.probe()) Thread.sleep(3) - println("Client Connect Socket") - val ioSocket = ClientServer.retry(1000, new UnixDomainSocket(ioPath)) - println("Client Connected Socket") + val outErr = ioSocket.getInputStream val in = ioSocket.getOutputStream val outPump = new ClientOutputPumper(outErr, stdout, stderr) @@ -55,10 +52,8 @@ class Client(lockBase: String, inThread.setDaemon(true) outThread.start() inThread.start() - println("Client Await Server Lock") locks.serverLock.await() - println("Client End") } } diff --git a/clientserver/src/mill/clientserver/Server.scala b/clientserver/src/mill/clientserver/Server.scala index 1271933d..a40c7cbe 100644 --- a/clientserver/src/mill/clientserver/Server.scala +++ b/clientserver/src/mill/clientserver/Server.scala @@ -35,17 +35,13 @@ class Server[T](lockBase: String, val originalStdout = System.out def run() = { locks.processLock.tryLockBlock{ - println("Server Process Lock") var running = true while (running) locks.serverLock.lockBlock{ - println("Server Lock") new File(ioPath).delete() - println("Server Accept Socket") val ioSocket = new UnixDomainServerSocket(ioPath) val sockOpt = ClientServer.interruptWith( acceptTimeout, { - println("Server Socket Timing Out Close") try new UnixDomainSocket(ioPath).close() catch{case e: Throwable => } } @@ -55,13 +51,10 @@ class Server[T](lockBase: String, sockOpt match{ case None => running = false case Some(sock) => - println("Server Handle Run") try handleRun(sock) catch{case e: Throwable => e.printStackTrace(originalStdout) } } - println("Server Unlock") } - println("Server Process Unlock") }.getOrElse(throw new Exception("PID already present")) } @@ -97,7 +90,6 @@ class Server[T](lockBase: String, ) t.start() - println("Server Poll Client/Done") // We cannot simply use Lock#await here, because the filesystem doesn't // realize the clientLock/serverLock are held by different threads in the // two processes and gives a spurious deadlock error @@ -107,7 +99,6 @@ class Server[T](lockBase: String, t.interrupt() t.stop() - println("Server Socket Close") clientSocket.close() } } |