From: Robert Klemme Date: 2003-05-09T00:52:25+09:00 Subject: Re: IO.pipe + thread = hangs (was: Re: capture output) schrieb im Newsbeitrag news:200305081214.h48CExeR010459@sharui.nakada.kanuma.tochigi.jp... > Hi, > > At Thu, 8 May 2003 20:50:29 +0900, > Robert Klemme wrote: > > True for me, too. Apparently I draw the wrong conclusion while > > experimenting with pipe redirecting. One of the scripts I was using for > > experiments (see attached) did seem to eat STDOUT output when STDERR was > > closed. Strange, though. > > 1) you cannot reopen closed stream. > > $ ruby -e 'STDOUT.close;STDOUT.reopen(STDERR)' > -e:1:in `reopen': closed stream (IOError) > from -e:1 I inserted the close before reopen only for experimental reasons. But thanks anyway! > 2) IO#reopen duplicates the file descriptor, so you have to > close also reopened stream to tell EOF to peer. > > puts "Sending message to parent" > STDERR.write "Hi Dad" > +STDERR.close > wr.close Aha! Thanks again! Regards robert