On Wed, 4 Jan 2006, Sky Yin wrote:

> Thank Yohanes for the detailed explanation. I've just tried using
>
> io = IO.popen("optimizer.exe", "r+")
> io.puts "..." #stdin<model.mod
> io.gets #stdout
> ...
> io.close
>
> It's weird that first two io.gets worked OK to retrieve the first two lines
> of the result, but then io.gets halted on the third io.gets. No clue.
>
> As for the session gem, I installed, but require 'session' simply returns a
> false under Win32.
>
> Thanks anyway.

session is not going to work under win32.  you'll need to do something like

   io = IO.popen("optimizer.exe", "r+")

   io.puts "..." # stdin<model.mod

   io.close_write

   stdout = io.read

   io.close

to avoid hanging on a gets with line buffered output.

regards.

-a
-- 
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================