You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2011/01/25 12:00:21 UTC
svn commit: r1063224 - in /ant/core/trunk: WHATSNEW
docs/manual/Tasks/sshexec.html
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
Author: bodewig
Date: Tue Jan 25 11:00:20 2011
New Revision: 1063224
URL: http://svn.apache.org/viewvc?rev=1063224&view=rev
Log:
Actually implement inputstring and document inputproperty. PR 50576
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/docs/manual/Tasks/sshexec.html
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1063224&r1=1063223&r2=1063224&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Jan 25 11:00:20 2011
@@ -21,6 +21,11 @@ Other changes:
attribute.
Bugzilla Report 50513.
+ * the documented inputstring attribute of sshexec has been
+ implemented and the actually existing attribute inputproperty
+ documented.
+ Bugzilla Report 50576.
+
Changes from Ant 1.8.1 TO Ant 1.8.2
===================================
Modified: ant/core/trunk/docs/manual/Tasks/sshexec.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/Tasks/sshexec.html?rev=1063224&r1=1063223&r2=1063224&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/Tasks/sshexec.html (original)
+++ ant/core/trunk/docs/manual/Tasks/sshexec.html Tue Jan 25 11:00:20 2011
@@ -145,7 +145,7 @@ and won't work with versions of jsch ear
<td valign="top">input</td>
<td valign="top">A file from which the executed command's standard
input is taken. This attribute is mutually exclusive with the
- inputstring attribute.<br/>
+ inputstring and inputproperty attributes.<br/>
When executing more than one command via commandResource, input
will be read for each command.
<em>since Ant 1.8.0</em></td>
@@ -159,13 +159,24 @@ and won't work with versions of jsch ear
<td align="center">No, defaults to false</td>
</tr>
<tr>
+ <td valign="top">inputproperty</td>
+ <td valign="top">Name of a property who's content serves as the
+ input stream for the executed command. This attribute is
+ mutually exclusive with the input and inputstring
+ attributes.<br/>
+ When executing more than one command via commandResource, input
+ will be read for each command.
+ <em>since Ant 1.8.0</em></td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
<td valign="top">inputstring</td>
<td valign="top">A string which serves as the input stream for the
executed command. This attribute is mutually exclusive with the
- input attribute.<br/>
+ input and inputproperty attributes.<br/>
When executing more than one command via commandResource, input
will be read for each command.
- <em>since Ant 1.8.0</em></td>
+ <em>since Ant 1.8.3</em></td>
<td align="center" valign="top">No</td>
</tr>
</table>
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java?rev=1063224&r1=1063223&r2=1063224&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java Tue Jan 25 11:00:20 2011
@@ -61,7 +61,8 @@ public class SSHExec extends SSHBase {
private String outputProperty = null; // like <exec>
private File outputFile = null; // like <exec>
- private String inputProperty = null; // like <exec>
+ private String inputProperty = null;
+ private String inputString = null; // like <exec>
private File inputFile = null; // like <exec>
private boolean append = false; // like <exec>
@@ -119,6 +120,8 @@ public class SSHExec extends SSHBase {
* If used, the content of the file is piped to the remote command
*
* @param input The file which provides the input data for the remote command
+ *
+ * @since Ant 1.8.0
*/
public void setInput(File input) {
inputFile = input;
@@ -127,13 +130,27 @@ public class SSHExec extends SSHBase {
/**
* If used, the content of the property is piped to the remote command
*
- * @param inputProperty The property which contains the input data for the remote command.
+ * @param inputProperty The property which contains the input data
+ * for the remote command.
+ *
+ * @since Ant 1.8.0
*/
public void setInputProperty(String inputProperty) {
this.inputProperty = inputProperty;
}
/**
+ * If used, the string is piped to the remote command.
+ *
+ * @param inputString the input data for the remote command.
+ *
+ * @since Ant 1.8.3
+ */
+ public void setInputString(String inputString) {
+ this.inputString = inputString;
+ }
+
+ /**
* Determines if the output is appended to the file given in
* <code>setOutput</code>. Default is false, that is, overwrite
* the file.
@@ -174,9 +191,13 @@ public class SSHExec extends SSHBase {
throw new BuildException("Command or commandResource is required.");
}
- if (inputFile != null && inputProperty != null) {
- throw new BuildException("You can't specify both inputFile and"
- + " inputProperty.");
+ int numberOfInputs = (inputFile != null ? 1 : 0)
+ + (inputProperty != null ? 1 : 0)
+ + (inputString != null ? 1 : 0);
+ if (numberOfInputs > 1) {
+ throw new BuildException("You can't specify more than one of"
+ + " inputFile, inputProperty and"
+ + " inputString.");
}
if (inputFile != null && !inputFile.exists()) {
throw new BuildException("The input file "
@@ -254,6 +275,9 @@ public class SSHExec extends SSHBase {
istream = new ByteArrayInputStream(inputData.getBytes()) ;
}
}
+ if (inputString != null) {
+ istream = new ByteArrayInputStream(inputString.getBytes());
+ }
try {
final ChannelExec channel;