Charles Calvert wrote in post #960600:
> You can do this, but you'll need to use the Win32 API to attach to a
> console (command shell) and be able to read and write to its STDIN and
> STDOUT.  See the links below:
>
> <http://www.dreamincode.net/code/snippet921.htm>
> <http://www.halcyon.com/~ast/dload/guicon.htm>
> <http://msdn.microsoft.com/en-us/library/ms681944%28VS.85%29.aspx>
>
> The first two are links to examples, and the last is to the MSDN
> documentation.  It's been a number of years since I did this, but it's
> the technique that Visual Studio uses to run the command-line
> compilers and pipe their output back into the IDE.

Thanks Charles, this looks promising.

One little question is whether the ruby program need to create another
process for the new console? the MSDN doc says "A process can be
associated with only one console, so the AllocConsole function fails if
the calling process already has a console. A process can use the
FreeConsole function to detach itself from its current console, then it
can call AllocConsole to create a new console or AttachConsole to attach
to another console.If the calling process creates a child process, the
child inherits the new console."

I am not familiar with calling Win AP in ruby, but I will surely take it
a try when I got time later.

-- 
Posted via http://www.ruby-forum.com/.