
org.xbib.gradle.task.elasticsearch.qa.LoggedResultJavaExec.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin-elasticsearch-build Show documentation
Show all versions of gradle-plugin-elasticsearch-build Show documentation
Gradle plugins for the developer kit for building and testing Elasticsearch and Elasticsearch plugins
The newest version!
package org.xbib.gradle.task.elasticsearch.qa
import org.gradle.api.GradleException
/**
* A wrapper around Gradle's Exec task to capture output and log on error.
*/
class LoggedResultJavaExec extends ResultJavaExec {
protected ByteArrayOutputStream output = new ByteArrayOutputStream()
LoggedResultJavaExec() {
if (!logger.isInfoEnabled()) {
standardOutput = output
errorOutput = output
doLast {
if (execResult.exitValue != 0) {
output.toString('UTF-8').eachLine { line -> logger.error(line) }
throw new GradleException("Process '${executable} ${args.join(' ')}' finished with non-zero exit value ${execResult.exitValue}")
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy