Workaround for gradle not liking the same stream for stdout and stderr sinks.
diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradle
index ff26748..55f904e 100644
--- a/gradle/documentation/render-javadoc.gradle
+++ b/gradle/documentation/render-javadoc.gradle
@@ -506,12 +506,23 @@
def outputFile = project.file("${getTemporaryDir()}/javadoc-output.txt")
def result
+
outputFile.withOutputStream { output ->
result = project.exec {
executable javadocCmd
- standardOutput = output
- errorOutput = output
+ // we want to capture both stdout and stderr to the same
+ // stream but gradle attempts to close these separately
+ // (it has two independent pumping threads) and it can happen
+ // that one still tries to write something when the other closed
+ // the underlying output stream.
+ def wrapped = new java.io.FilterOutputStream(output) {
+ public void close() {
+ // no-op. we close this stream manually.
+ }
+ }
+ standardOutput = wrapped
+ errorOutput = wrapped
args += [ "@${optionsFile}" ]
@@ -522,6 +533,8 @@
ignoreExitValue true
}
+
+ logger.lifecycle("Exec returned: ${result}")
}
if (result.getExitValue() != 0) {