Gradle tests: output compiler process stdout and stderr

This commit is contained in:
Alexander Udalov
2014-08-10 19:00:44 +04:00
parent 6588310736
commit 423a48c7c3
@@ -2,6 +2,7 @@ package org.jetbrains.kotlin.gradle
import com.google.common.io.Files
import java.io.File
import java.io.InputStream
import java.util.Scanner
import org.junit.Before
import org.junit.After
@@ -76,16 +77,19 @@ open class BaseGradleIT(resourcesRoot: String = "src/test/resources") {
}
private fun readOutput(process: Process): Pair<String, Int> {
val s = Scanner(process.getInputStream()!!)
val text = StringBuilder()
while (s.hasNextLine()) {
text append s.nextLine()
text append "\n"
fun InputStream.readFully(): String {
val text = reader().readText()
close()
return text
}
s.close()
val stdout = process.getInputStream()!!.readFully()
System.out.println(stdout)
val stderr = process.getErrorStream()!!.readFully()
System.err.println(stderr)
val result = process.waitFor()
return text.toString() to result
return stdout to result
}
fun copyRecursively(source: File, target: File) {