[Ironruby-core] Replacing StandardInput for ScriptEngine?
Nathan_Stults at HSIHealth.com
Thu Nov 5 15:30:15 EST 2009
I am experimenting with script IO in preparation for hosting an IRB
session via an embedded SSH server and/or embedded HTTP server, but I'm
having trouble getting the script environment to use a custom stream for
standard input. I used the following code for setting up my IronRuby
_stdIn = new MemoryStream();
_inputWriter = new StreamWriter(_stdIn);
_stdOut = new FifoStream();
_outputReader = new StreamReader(_stdOut);
_stdOut.DataArrived += StdOutDataArrived;
_scriptEngine = Ruby.CreateEngine();
_globalScope = _scriptEngine.CreateScope();
If I write "hello" + Environment.NewLine to the input stream and flush
the writer and then use the ScriptEngine e to execute a "x = gets" - x
is always nil. However, if I use the script engine to execute "puts
'hello'" my custom output stream is used and I see my output.
I feel like I am missing a key ingredient in my setup process - any help
would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironruby-core