[Test] Properly handle output from separate jvm instance in box tests
This commit is contained in:
committed by
teamcityserver
parent
13b5f87f3a
commit
c8386ad1c7
+16
-5
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user