You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/01/19 16:14:17 UTC

[lucene-solr] branch LUCENE-9670 created (now cf699e2)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a change to branch LUCENE-9670
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


      at cf699e2  Workaround for gradle not liking the same stream for stdout and stderr sinks.

This branch includes the following new commits:

     new cf699e2  Workaround for gradle not liking the same stream for stdout and stderr sinks.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-solr] 01/01: Workaround for gradle not liking the same stream for stdout and stderr sinks.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch LUCENE-9670
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit cf699e266c6967cfee89c5cfb379370764434a87
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Tue Jan 19 17:14:00 2021 +0100

    Workaround for gradle not liking the same stream for stdout and stderr sinks.
---
 gradle/documentation/render-javadoc.gradle | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

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 @@ class RenderJavadocTask extends DefaultTask {
 
     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 @@ class RenderJavadocTask extends DefaultTask {
 
         ignoreExitValue true
       }
+
+      logger.lifecycle("Exec returned: ${result}")
     }
 
     if (result.getExitValue() != 0) {