You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by da...@apache.org on 2014/12/29 04:49:40 UTC

maven-wagon git commit: [WAGON-431] process remote stdout stream first before stderr stream to prevent blocking when stdout stream size is > 32K

Repository: maven-wagon
Updated Branches:
  refs/heads/master 94dd5f14e -> 88a6f12d1


[WAGON-431] process remote stdout stream first before stderr stream to
prevent blocking when stdout stream size is > 32K

Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/88a6f12d
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/88a6f12d
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/88a6f12d

Branch: refs/heads/master
Commit: 88a6f12d10c847148ac262693f200d4ad8545016
Parents: 94dd5f1
Author: dantran <da...@gmail.com>
Authored: Sun Dec 28 19:49:43 2014 -0800
Committer: dantran <da...@gmail.com>
Committed: Sun Dec 28 19:49:43 2014 -0800

----------------------------------------------------------------------
 .../ssh/CommandExecutorStreamProcessor.java     | 41 ++++++++++----------
 1 file changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/88a6f12d/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
index a582d14..ebd5967 100644
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
+++ b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
@@ -25,7 +25,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 
 /**
- * CommandExecutorStreamProcessor 
+ * CommandExecutorStreamProcessor
  *
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  *
@@ -41,25 +41,6 @@ public class CommandExecutorStreamProcessor
         throws IOException
     {
         Streams streams = new Streams();
-
-        while ( true )
-        {
-            String line = stderrReader.readLine();
-
-            if ( line == null )
-            {
-                break;
-            }
-
-            // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that
-            // don't have exit codes ignore this error. TODO: output a warning
-            if ( !line.startsWith( "Could not chdir to home directory" )
-                 && !line.endsWith( "ttyname: Operation not supported" ) )
-            {
-                streams.setErr( streams.getErr() + line + "\n" );
-            }
-        }
-
         while ( true )
         {
             String line = stdoutReader.readLine();
@@ -83,6 +64,26 @@ public class CommandExecutorStreamProcessor
 //                in.read( trashcan, 0, avail );
 //            }
 
+        // drain stderr next, if stream size is more than the allowed buffer size
+        // ( ie jsch has a hardcoded 32K size), the remote shell may be blocked. See WAGON-431
+        while ( true )
+        {
+            String line = stderrReader.readLine();
+
+            if ( line == null )
+            {
+                break;
+            }
+
+            // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that
+            // don't have exit codes ignore this error. TODO: output a warning
+            if ( !line.startsWith( "Could not chdir to home directory" )
+                 && !line.endsWith( "ttyname: Operation not supported" ) )
+            {
+                streams.setErr( streams.getErr() + line + "\n" );
+            }
+        }
+
         return streams;
     }
 }