maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r366406 - /maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
Date Fri, 06 Jan 2006 03:28:28 GMT
Author: brett
Date: Thu Jan  5 19:28:25 2006
New Revision: 366406

URL: http://svn.apache.org/viewcvs?rev=366406&view=rev
Log:
ignore failures in chmod/chgrp to go with the -f flag.

Modified:
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java?rev=366406&r1=366405&r2=366406&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
Thu Jan  5 19:28:25 2006
@@ -86,6 +86,8 @@
 
     private String password;
 
+    private static final int SSH_FATAL_EXIT_CODE = 255;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -170,7 +172,7 @@
         // nothing to disconnect
     }
 
-    public void executeCommand( String command )
+    public void executeCommand( String command, boolean ignoreFailures )
         throws CommandExecutionException
     {
         boolean putty = sshExecutable.indexOf( "plink" ) >= 0;
@@ -203,11 +205,17 @@
 
         try
         {
+            CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
             CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
-            int exitCode = CommandLineUtils.executeCommandLine( cl, null, err );
+            int exitCode = CommandLineUtils.executeCommandLine( cl, out, err );
+            fireSessionDebug( out.getOutput() );
+            fireSessionDebug( err.getOutput() );
             if ( exitCode != 0 )
             {
-                throw new CommandExecutionException( "Exit code " + exitCode + " - " + err.getOutput()
);
+                if ( !ignoreFailures || exitCode == SSH_FATAL_EXIT_CODE )
+                {
+                    throw new CommandExecutionException( "Exit code " + exitCode + " - "
+ err.getOutput() );
+                }
             }
         }
         catch ( CommandLineException e )
@@ -346,7 +354,8 @@
 
             if ( permissions != null && permissions.getGroup() != null )
             {
-                executeCommand( "chgrp -f " + permissions.getGroup() + " " + basedir + "/"
+ resourceName + "\n" );
+                executeCommand( "chgrp -f " + permissions.getGroup() + " " + basedir + "/"
+ resourceName + "\n",
+                                true );
             }
 
             String fileMode = "644";
@@ -354,13 +363,19 @@
             {
                 fileMode = permissions.getFileMode();
             }
-            executeCommand( "chmod -f " + fileMode + " " + basedir + "/" + resourceName +
"\n" );
+            executeCommand( "chmod -f " + fileMode + " " + basedir + "/" + resourceName +
"\n", true );
         }
         catch ( CommandExecutionException e )
         {
             throw new TransferFailedException( "Error executing command for transfer", e
);
         }
         firePutCompleted( resource, source );
+    }
+
+    public void executeCommand( String command )
+        throws CommandExecutionException
+    {
+        executeCommand( command, false );
     }
 
     public void get( String resourceName, File destination )



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message