JavaEmbedUtils should have methods to set/reset Standard I/O ------------------------------------------------------------
Key: JRUBY-3662 URL: http://jira.codehaus.org/browse/JRUBY-3662 Project: JRuby Issue Type: New Feature Components: Embedding Affects Versions: JRuby 1.3 Reporter: Yoko Harada Attachments: ReassignStandardIO.patch Current implementation does not have any short-cut method to change $stdin(STDIN), $stdout(STDOUT, $defout, $>), and $stderr(STDERR, $deferr). Thus, an embed program need to use JRuby's internal API to support the feature, which enables to change the assigned streams of standard I/O. One example is in org.jruby.demo.TextAreaReadline. However, it is not a good idea to use internal API directly. Changing assigned streams of standard I/O is necessary when implementing JSR 223 Scripting API, and is also a good feature for web application and debugging for embedders For example, we can set a stream, returned from HttpServletResponse.getWriter(), to $stdout. Then output of "puts 'Hello'" will be sent back to a browser. If we set StringWriter to $stdout, the output of "puts 'Hello'" will be written to StringWriter. So, assertEquals("Hello", stringWriter.toString()); works. For these reasons, JavaEmbedUtils should have methods to reassign standard I/O. Since embed API converts Reader/Writer to Input/OutputStream, methods' arguments in JavaEmbedUtils can have Input/OutputStream types. This is suitable to methods in JavaEmbedUtils. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email