From: Carsten Gronski Date: 2002-06-16T07:39:05+09:00 Subject: Re: Question: how to do (repeated) bidirectional communication with another process via stdin/stdout ? ruby-talk@ruby-lang.org schrieb am 15.06.02 19:59:55: > On 2002.06.16, Carsten Gronski wrote: > > My problem is, that the standard Ruby IO class seems not to allow this > > type of repeated bidirectional communication dialog with another > > process. Something like ke = IO.popen("ke.exe", "r+") would give me a > > bidirectional communication channel, but unfortunatly it is not > > possible to read from the I/O stream until the write end of the I/O > > stream is closed. > > Remember to flush after writing. Or, set the IO to auto-flush. > > -- Dossy > > -- > Dossy Shiobara mail: dossy@panoptic.com > Panoptic Computer Network web: http://www.panoptic.com/ > "He realized the fastest way to change is to laugh at your own > folly -- then you can let go and quickly move on." (p. 70) Thanks, but flushing won' t help. Something like this does not work. the program hangs, when trying the second write. .. if (ke != nil) ke.syswrite(loginCall) ke.flush() ke.each("\n") { |line| puts(line) } # we get until here # this does not get through ke.syswrite(sysInfoCall) ke.flush() # we never get here -- program hangs !! ke.close_write ke.each("\n") { |line| puts(line) } ke.close end -- Carsten ______________________________________________________________________________ FreeMail in der Premiumversion! Mit mehr Speicher, mehr Leistung, mehr Erlebnis und mehr Pramie. Jetzt unter http://club.web.de/?mc=021105