private void setOutputStream(PrintStream pstream) {
if (pstream == null) {
return;
}
Ruby runtime = provider.getRuntime();
RubyIO io = new RubyIO(runtime, pstream);
io.getOpenFile().setSync(true);
runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", io), GlobalVariable.Scope.GLOBAL);
runtime.getObject().storeConstant("STDOUT", io);
runtime.getGlobalVariables().alias("$>", "$stdout");
runtime.getGlobalVariables().alias("$defout", "$stdout");
}