From a903aabbd6afc95a2e344f9db2a1fff1d1f820a0 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 29 Mar 2017 13:42:47 -0700 Subject: [PATCH] Build: Ensure upstream check works even when using info logging (#23804) The LoggedExec task does not capture output when info logging is enabled. This commit changes the upstream check to use Exec directly, so as not to break when info logging is enabled. --- distribution/bwc-zip/build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/distribution/bwc-zip/build.gradle b/distribution/bwc-zip/build.gradle index 3c2be36045b..4370fae11fd 100644 --- a/distribution/bwc-zip/build.gradle +++ b/distribution/bwc-zip/build.gradle @@ -35,11 +35,19 @@ task createClone(type: LoggedExec) { commandLine = ['git', 'clone', rootDir, checkoutDir] } -task findUpstream(type: LoggedExec) { +// we use regular Exec here to ensure we always get output, regardless of logging level +task findUpstream(type: Exec) { dependsOn createClone workingDir = checkoutDir commandLine = ['git', 'remote', '-v'] + ignoreExitValue = true + ByteArrayOutputStream output = new ByteArrayOutputStream() + standardOutput = output doLast { + if (execResult.exitValue != 0) { + output.toString('UTF-8').eachLine { line -> logger.error(line) } + execResult.assertNormalExitValue() + } project.ext.upstreamExists = false output.toString('UTF-8').eachLine { if (it.contains("upstream")) {