From: Gennady Date: 2003-06-28T08:41:05+09:00 Subject: exit! affects stdout redirection to a file This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C33CCA.E6B22200 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Is there an explanation for the following behaviour: ruby -e "puts 'abcd'" > aaa file aaa will contain 'abcd' However if you run ruby -e "puts 'abcd';exit!" > aaa file aaa will be empty. At the same time: ruby -e "puts 'abcd';exit!"=20 will display 'abcd' on the screen. Somehow, exit! do not only execute at_exit handler and bypasses = finalizers, but also do not flush the last puts if stdout is redirected. = Very strange. [x86.bison:9]gfb> ruby -v ruby 1.6.8 (2002-12-24) [i386-solaris2.8] Thank you, Gennady. P.S. Same behaviour on Linux [lnx.bear:54]bystr> ruby -v ruby 1.6.8 (2002-12-24) [i686-linux] ------=_NextPart_000_0007_01C33CCA.E6B22200 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable
Is there an explanation for the = following=20 behaviour:
 
ruby -e "puts 'abcd'" > = aaa
file aaa will = contain 'abcd'
 
However if you run
 
ruby -e "puts 'abcd';exit!" > = aaa
file aaa will be empty.
 
At the same time:
 
ruby -e "puts 'abcd';exit!" =
will display 'abcd' on the = screen.
 
Somehow, exit! do not only execute = at_exit handler=20 and bypasses finalizers, but also do not flush the last puts if stdout = is=20 redirected. Very strange.
 
[x86.bison:9]gfb> ruby -v
ruby = 1.6.8=20 (2002-12-24) [i386-solaris2.8]
 
Thank you,
Gennady.
 
P.S. Same behaviour on = Linux
[lnx.bear:54]bystr> ruby -v
ruby = 1.6.8=20 (2002-12-24) [i686-linux]
 
------=_NextPart_000_0007_01C33CCA.E6B22200--