diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt index ea18b30f..4d4ec96f 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/NewRunCommand.kt @@ -37,6 +37,8 @@ class RunCommandInfo { ! hasErrors } + + var containsErrors: ((List) -> Boolean)? = null } fun runCommand(init: RunCommandInfo.() -> Unit) = NewRunCommand(RunCommandInfo().apply { init() }).invoke() @@ -84,7 +86,9 @@ open class NewRunCommand(val info: RunCommandInfo) { else listOf() // Check to see if the command succeeded - val isSuccess = isSuccess(returnCode, input, error) + val isSuccess = + if (info.containsErrors != null) ! info.containsErrors!!(error) + else isSuccess(returnCode, input, error) if (isSuccess) { info.successCallback(input) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt index 992fd64b..f309d4ce 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt @@ -111,7 +111,7 @@ class KotlinCompiler @Inject constructor( args = newArgs directory = File(".") // The Kotlin compiler issues warnings on stderr :-( - useErrorStreamAsErrorIndicator = false + containsErrors = { errors: List -> errors.any { it.contains("rror")} } }).invoke() return TaskResult(result == 0, "Error while compiling") }