You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/08/28 09:10:40 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh SSHExec.java

bodewig     2003/08/28 00:10:40

  Modified:    docs/manual/OptionalTasks scp.html sshexec.html
               src/main/org/apache/tools/ant/taskdefs/optional/ssh
                        SSHExec.java
  Log:
  Make <sshexec> evaluate the exit code of the remote command.
  
  PR: 19237
  Based on a submission by:	Rob Meyer <rob at bigdis dot com>
  
  Revision  Changes    Path
  1.7       +2 -1      ant/docs/manual/OptionalTasks/scp.html
  
  Index: scp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/scp.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- scp.html	1 Apr 2003 13:01:09 -0000	1.6
  +++ scp.html	28 Aug 2003 07:10:39 -0000	1.7
  @@ -19,7 +19,8 @@
   <p><b>Note:</b> This task depends on external libraries not included
   in the Ant distribution.  See <a
   href="../install.html#librarydependencies">Library Dependencies</a>
  -for more information.  This task has been tested with jsch-0.1.2 and jsch-0.1.3.</p>
  +for more information.  This task has been tested with jsch-0.1.2 to
  +jsch-0.1.7.</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  
  
  
  1.5       +2 -1      ant/docs/manual/OptionalTasks/sshexec.html
  
  Index: sshexec.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/sshexec.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sshexec.html	1 Apr 2003 13:05:25 -0000	1.4
  +++ sshexec.html	28 Aug 2003 07:10:39 -0000	1.5
  @@ -18,7 +18,8 @@
   <p><b>Note:</b> This task depends on external libraries not included
   in the Ant distribution.  See <a
   href="../install.html#librarydependencies">Library Dependencies</a>
  -for more information.  This task has been tested with jsch-0.1.3.</p>
  +for more information.  This task has been tested with jsch-0.1.7 and
  +won't work with earlier versions of jsch..</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  
  
  
  1.9       +15 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
  
  Index: SSHExec.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SSHExec.java	9 Jul 2003 12:12:59 -0000	1.8
  +++ SSHExec.java	28 Aug 2003 07:10:40 -0000	1.9
  @@ -214,8 +214,22 @@
                   if (outputFile != null) {
                       writeToFile(out.toString(), append, outputFile);
                   }
  +
  +                // this is the wrong test if the remote OS is OpenVMS,
  +                // but there doesn't seem to be a way to detect it.
  +                int ec = channel.getExitStatus();
  +                if (ec != 0) {
  +                    String msg = "Remote command failed with exit status " + ec;
  +                    if (getFailonerror()) {
  +                        throw new BuildException(msg);
  +                    } else {
  +                        log(msg, Project.MSG_ERR);
  +                    }
  +                }
               }
   
  +        } catch (BuildException e) {
  +            throw e;
           } catch (Exception e) {
               if (getFailonerror()) {
                   throw new BuildException(e);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org