[Gradle, JS] Add more info for check exit code
This commit is contained in:
+8
-3
@@ -13,7 +13,6 @@ import org.gradle.process.internal.ExecActionFactory
|
|||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.PipedInputStream
|
import java.io.PipedInputStream
|
||||||
import java.io.PipedOutputStream
|
import java.io.PipedOutputStream
|
||||||
import java.nio.CharBuffer
|
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
internal fun Project.execWithProgress(description: String, readStdErr: Boolean = false, body: (ExecAction) -> Unit): ExecResult {
|
internal fun Project.execWithProgress(description: String, readStdErr: Boolean = false, body: (ExecAction) -> Unit): ExecResult {
|
||||||
@@ -32,7 +31,7 @@ internal fun Project.execWithProgress(description: String, readStdErr: Boolean =
|
|||||||
val buffer = StringBuilder()
|
val buffer = StringBuilder()
|
||||||
while (true) {
|
while (true) {
|
||||||
val read = reader.read()
|
val read = reader.read()
|
||||||
if (read == -1) break;
|
if (read == -1) break
|
||||||
val ch = read.toChar()
|
val ch = read.toChar()
|
||||||
if (ch == '\b' || ch == '\n' || ch == '\r') {
|
if (ch == '\b' || ch == '\n' || ch == '\r') {
|
||||||
if (buffer.isNotEmpty()) {
|
if (buffer.isNotEmpty()) {
|
||||||
@@ -55,7 +54,13 @@ internal fun Project.execWithProgress(description: String, readStdErr: Boolean =
|
|||||||
val result = exec.execute()
|
val result = exec.execute()
|
||||||
outputReaderThread.join()
|
outputReaderThread.join()
|
||||||
if (result.exitValue != 0) {
|
if (result.exitValue != 0) {
|
||||||
error(stderr.toString() + "\n" + stdout)
|
error(
|
||||||
|
"""
|
||||||
|
Process '$description' returns ${result.exitValue}
|
||||||
|
$stderr
|
||||||
|
$stdout
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user