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:09:20 UTC

DO NOT REPLY [Bug 41154] 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=41154>.
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=41154

           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 41154] - 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=41154>.
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=41154





------- Additional Comments From jan@materne.de  2006-12-12 02:31 -------
*** Bug 41155 has been marked as a duplicate of this bug. ***

-- 
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 41154] - 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=41154>.
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=41154


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From gudnabrsam@yahoo.com  2006-12-12 07:11 -------
(In reply to comment #0)
[SNIP]
> 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.

I'm afraid I don't understand the process by which you arrived at this
conclusion.  Maybe your time would be better spent putting together an example
you can attach to this report so that we can get a better picture of the overall
situation.

-Matt


-- 
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