Re: [tcljava-user] Jacl documentation
Brought to you by:
mdejong
From: rahul <Rah...@Su...> - 2006-11-27 16:08:59
|
[Wei Dai:] | I am not planning to manipulate them; all I want is to be able to | retrieve them since we wanted to provide a console log that display what | user would see if they run tclsh directly. So if puts commands result | only comes from the STDOUT, I need to a way to get it. Same for the | STDERR, it seems to me that Interp.getResults can provide error message | in the error case, but is it the same message that I would get from | STDERR? The interp.getResults will not give you the output from puts command. it contains only the results of a function call/expression evaluation. which is different from writing to stdstreams. to capture the error information, this is what is done in the Shell, try { ...cmd evaluation.. } catch (TclException e) { switch (e.getCompletionCode()) { case TCL.ERROR println(errstream, interp.getResult().toString()) } } so yes, it is the same message. You can capture the puts output by changing the stdstreams in java. Take a look at extras/GuiShell/GuiShell.java: setupStreamReaders. You can see how the streams are diverted. |