From: nobu.nokada@... Date: 2003-05-16T10:30:42+09:00 Subject: Re: another popen question...the ruby bbs Hi, At Fri, 16 May 2003 09:55:55 +0900, nedry wrote: > All this talk of popen put me in mind of something. I could > use it to link the Ruby BBS to external programs, > specifically all those old dos door games by using dosemu and > redirecting the output... > > I got it to get the data from the application ok, but I can't > figure out how to get data to the application.... nothing > seems to be happening when I write data to the external > process... any ideas, advice, boots to the head would be > appreciated (keeping in mind that it is now 2am...) I don't know about that "old dos door game", does it read from stdin certainly? > while true > puts ("loop...") > if select([pipe],nil,nil,0.1) !=nil Separating select call would not be nice. while ios = select([pipe, @socket]) r, * = ios if r.include?(pipe) char = pipe.getc puts "char: #{char}" @socket.write ?\r if char == LF @socket.write(char.chr) end if r.include?(@socket) puts "socket hit" char = @socket.getc puts char.chr pipe.putc(char.chr) if char end end -- Nobu Nakada