Replace daemon's message after start with constant string

#KT-15783 fixed

When a daemon client cannot find an existing daemon, it starts a new one.
The client waits for a daemon to start and initialize.
Then the daemon is expected to signal that it is ready for compiling by printing message in stdout.
Before this change the message was the daemons' run path (a directory where all daemons store
their "flag" files).
However the path printed by the daemon was not matched by the path expected by the client somehow
on Windows for a user with a username containing non-English letters.
This commit replaces the message with the constant string.
This commit is contained in:
Alexey Tsvetkov
2017-02-16 23:33:31 +03:00
parent b2de822fd4
commit 3b222f13f3
3 changed files with 3 additions and 5 deletions
@@ -341,7 +341,7 @@ object KotlinCompilerClient {
daemon.inputStream
.reader()
.forEachLine {
if (daemonOptions.runFilesPath.isNotEmpty() && it.contains(daemonOptions.runFilesPath)) {
if (it == COMPILE_DAEMON_IS_READY_MESSAGE) {
isEchoRead.release()
return@forEachLine
}
@@ -48,6 +48,7 @@ val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec
val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L
val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs
val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L
val COMPILE_DAEMON_IS_READY_MESSAGE = "Kotlin compile daemon is ready"
val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() =
FileSystem.getRuntimeStateFilesPath("kotlin", "daemon")
@@ -35,7 +35,6 @@ import kotlin.concurrent.schedule
val DAEMON_PERIODIC_CHECK_INTERVAL_MS = 1000L
class LogStream(name: String) : OutputStream() {
val log by lazy { Logger.getLogger(name) }
@@ -154,9 +153,7 @@ object KotlinCompileDaemon {
}
})
if (daemonOptions.runFilesPath.isNotEmpty())
println(daemonOptions.runFilesPath)
println(COMPILE_DAEMON_IS_READY_MESSAGE)
log.info("daemon is listening on port: $port")
// this supposed to stop redirected streams reader(s) on the client side and prevent some situations with hanging threads, but doesn't work reliably