From: Tim Hammerquist Date: 2002-02-22T10:19:16+09:00 Subject: Re: Now I'm really confused! Chris Gehlker graced us by uttering: > I'm still struggling with producing RubyStudio. The following example > illustrates my dilemma: > > This works from the shell: > $stdout.print "Enter a string:" > a = $stdin.gets > > But hangs the thread in RubyStudio that's waiting to see some output from > Ruby. This however works in both environments: > > $stdout.print "Enter a string:" > $stdout.flush > a = $stdin.gets > > What I can't figure out is why Ruby behaves differently depending on how it > was launched. Does tcsh set some environmental variable that tells Ruby not > to buffer output? I printed out man tcsh but it's a small book without an > index. Please help. I'm not familiar with RubyStudio, but it occurs to me that it may have to do with the fact that the shell is connected to a tty whereas RubyStudio may be using a pipe or socket. tty's behave differently and may be flushing automatically. I doubt it's related to the shell. HTH Tim Hammerquist -- "Supported" is an MS term that means the function exists. The fact that it always fails means that it is an exercise for the programmer. -- Sarathy, p5p