From: nobu.nokada@... Date: 2002-01-30T20:35:08+09:00 Subject: Re: popen3 and buffering Hi, At Wed, 30 Jan 2002 20:04:14 +0900, ts wrote: > P> rb_eval_string( > P> "class IO\n" > P> " PIPE_BUFFERS = Hash.new\n" > P> " def self.pipe_buffer_finalizer(buf)\n" > P> " PIPE_BUFFERS[buf] = true\n" > P> " return proc { PIPE_BUFFERS.delete(buf) }\n" > P> " end\n" > P> " def setvbuf(mode, buf=nil)\n" > P> " if buf then\n" > P> " ObjectSpace.define_finalizer(self, IO.pipe_buffer_finalizer(buf))\n" > P> " end\n" > P> " c_setvbuf(mode, buf)\n" > P> " end\n" > > What I've not understood is why you want to use a constant (PIPE_BUFFERS) > rather than an instance variable ? If you mean IO instance object's instance variable, I guess he wants to prevent the buffer from GC. But, IO#setvbuf(IO::NBF) looks to be equivalent to IO#sync=true actually. I can't understand why he must set $stdout.sync to false. -- Nobu Nakada