You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/12/12 09:13:40 UTC
DO NOT REPLY [Bug 41155] New: - The output of sshexec can't be captured by GUI
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41155>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41155
Summary: The output of sshexec can't be captured by GUI
Product: Ant
Version: 1.7.0RC1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: dev@ant.apache.org
ReportedBy: wdu@ebay.com
I construct my own GUI to run testcases written by ant scripts
I hope to redirect the output to textarea at the beginning of run and
redirect the output back to console at the end of the run.
Those echo message and log message can be print in textarea easily but
the output of sshexec can't be print in textarea.
My related codes are as below:
class FilteredStream extends FilterOutputStream {
public FilteredStream(OutputStream aStream) {
super(aStream);
}
public void write(byte b[]) throws IOException {
String aString = new String(b);
postInfo(aString);
}
public void write(byte b[], int off, int len) throws
IOException {
String aString = new String(b , off , len);
postInfo(aString);
}
}
private void postInfo(String message) {
taskOutput.append(message);
//eBARTMainPanel.getResultTextPane().append(message);
if("\r\n".equals(message)||"\n".equals(message))
return;
else
_log.info(message.replaceAll("\n",""));
}
private void redirectOutputToTextArea(){
PrintStream out =
new PrintStream(
new FilteredStream(
new ByteArrayOutputStream()));
defaultPrintStream = System.out;
System.setOut(out);
System.setErr(out);
}
private void redirectOutputToConsole(){
System.setOut(defaultPrintStream);
System.setErr(defaultPrintStream);
}
Therefore, I debug into the source code of ant.
In class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec
line 136:
TeeOutputStream tee = new TeeOutputStream(out, new KeepAliveOutputStream
(System.out));
and in class org.apache.tools.ant.util.KeepAliveOutputStream
it extends class java.io.FilterOutputStream but didn't implement method such
as write(byte[] b) and write(byte[] b, int off, int len)
I believe that's why the sshexec output can't be written to the textarea.
Thanks,
-Nicholas
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 41155] - The output of sshexec can't be captured by GUI
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41155>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41155
jan@materne.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
------- Additional Comments From jan@materne.de 2006-12-12 02:31 -------
*** This bug has been marked as a duplicate of 41154 ***
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org