can only set Out and Error once...
----------------------------------
Key: JRUBY-5958
URL: https://jira.codehaus.org/browse/JRUBY-5958
Project: JRuby
Issue Type: Bug
Components: Embedding
Affects Versions: JRuby 1.6.3
Reporter: Miroslav Pokorny
I am embedding JRuby and running tests against it. Rather than printing to
Sys.out i am printing to a PrintStream that writes to a StringBuilder. However
my problem is only the first test actually puts to my PrintStream, all other
tests with puts do not print to the PrintSream that was just set. To
demonstrate the problem is not my PrintStreams fault i have included a small
class with a Main which loops. Take a look and when run it will only print to
the first file. Adding ScriptingContainer.resetWriter does not fix the problem.
import java.io.PrintStream;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
public class JRubyPutsProblem {
public static void main(String[] args) throws Exception {
for (int i = 0; i < 3; i++) {
final ScriptingContainer container = new
ScriptingContainer(LocalContextScope.CONCURRENT,
LocalVariableBehavior.PERSISTENT);
// container.resetWriter();
// container.resetErrorWriter();
final PrintStream printStream = new PrintStream("d:\\out" + i +
".txt");
container.setOutput(printStream);
container.setError(printStream);
container.runScriptlet("puts \"hello" + i + "\"\n");
printStream.flush();
container.terminate();
}
}
}
--
This message is automatically generated by JIRA.
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