Browse Source

support for pseudo-terminals in sshexec. PR 52554

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1239121 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 13 years ago
parent
commit
cd98668053
3 changed files with 19 additions and 0 deletions
  1. +3
    -0
      WHATSNEW
  2. +6
    -0
      manual/Tasks/sshexec.html
  3. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java

+ 3
- 0
WHATSNEW View File

@@ -183,6 +183,9 @@ Other changes:


* Initial support for Java 8. * Initial support for Java 8.


* <sshexec> can optionally create a pseudo terminal (like ssh -t)
Bugzilla Report 52554.

Changes from Ant 1.8.1 TO Ant 1.8.2 Changes from Ant 1.8.1 TO Ant 1.8.2
=================================== ===================================




+ 6
- 0
manual/Tasks/sshexec.html View File

@@ -179,6 +179,12 @@ and won't work with versions of jsch earlier than
<em>since Ant 1.8.3</em></td> <em>since Ant 1.8.3</em></td>
<td align="center" valign="top">No</td> <td align="center" valign="top">No</td>
</tr> </tr>
<tr>
<td valign="top">usepty</td>
<td valign="top">Whether to allocate a pseudo-tty (like ssh -t).
<em>since Ant 1.8.3</em></td>
<td align="center" valign="top">No, defaults to false</td>
</tr>
</table> </table>


<h3>Examples</h3> <h3>Examples</h3>


+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java View File

@@ -65,6 +65,7 @@ public class SSHExec extends SSHBase {
private String inputString = null; // like <exec> private String inputString = null; // like <exec>
private File inputFile = null; // like <exec> private File inputFile = null; // like <exec>
private boolean append = false; // like <exec> private boolean append = false; // like <exec>
private boolean usePty = false;


private Resource commandResource = null; private Resource commandResource = null;


@@ -171,6 +172,14 @@ public class SSHExec extends SSHBase {
outputProperty = property; outputProperty = property;
} }


/**
* Whether a pseudo-tty should be allocated.
* @since Apache Ant 1.8.3
*/
public void setUsePty(boolean b) {
usePty = b;
}

/** /**
* Execute the command on the remote host. * Execute the command on the remote host.
* *
@@ -290,6 +299,7 @@ public class SSHExec extends SSHBase {
if (istream != null) { if (istream != null) {
channel.setInputStream(istream); channel.setInputStream(istream);
} }
channel.setPty(usePty);
channel.connect(); channel.connect();
// wait for it to finish // wait for it to finish
thread = thread =


Loading…
Cancel
Save