diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt index 9ecb4f9378e..f7cf735539e 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt @@ -210,12 +210,23 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }), mainFqName, ) - val process = ProcessBuilder(command).inheritIO().start() + val process = ProcessBuilder(command).start() process.waitFor(1, TimeUnit.MINUTES) - process.outputStream.flush() - return when (process.exitValue()) { - 0 -> "OK" - else -> "External process completed with error. Check the build log" + return try { + when (process.exitValue()) { + 0 -> "OK" + else -> buildString { + for (stream in listOfNotNull(process.inputStream, process.errorStream)) { + stream.bufferedReader().lines().forEach { appendLine(it) } + } + + if (this.isEmpty()) { + appendLine("External process completed with error. Check the build log") + } + } + } + } finally { + process.outputStream.flush() } }