ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh SSHExec.java
Date Mon, 14 Mar 2005 09:02:48 GMT
bodewig     2005/03/14 01:02:48

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ssh
                        SSHExec.java
  Log:
  Explicitly disconnect the session, PR: 26757
  
  Revision  Changes    Path
  1.19      +6 -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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SSHExec.java	9 Mar 2005 00:20:41 -0000	1.18
  +++ SSHExec.java	14 Mar 2005 09:02:48 -0000	1.19
  @@ -137,9 +137,10 @@
           ByteArrayOutputStream out = new ByteArrayOutputStream();
           TeeOutputStream tee = new TeeOutputStream(out, System.out);
   
  +        Session session = null;
           try {
               // execute the command
  -            Session session = openSession();
  +            session = openSession();
               session.setTimeout((int) maxwait);
               final ChannelExec channel = (ChannelExec) session.openChannel("exec");
               channel.setCommand(command);
  @@ -219,6 +220,10 @@
               } else {
                   log("Caught exception: " + e.getMessage(), Project.MSG_ERR);
               }
  +        } finally {
  +            if (session != null && session.isConnected()) {
  +                session.disconnect();
  +            }
           }
       }
   
  
  
  

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


Mime
View raw message