From 3b222f13f346e1677e3ee0256d8b3768ba6addc6 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Thu, 16 Feb 2017 23:33:31 +0300 Subject: [PATCH] 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. --- .../jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt | 2 +- .../src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt | 1 + .../src/org/jetbrains/kotlin/daemon/KotlinCompileDaemon.kt | 5 +---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt index b95bef24e38..6adf4bbc8fe 100644 --- a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt +++ b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt @@ -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 } diff --git a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt index e6aeb7c0a41..9e811ce780a 100644 --- a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt +++ b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt @@ -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") diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/KotlinCompileDaemon.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/KotlinCompileDaemon.kt index 9d7413d6416..c9c28e4bea8 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/KotlinCompileDaemon.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/KotlinCompileDaemon.kt @@ -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