G
Gennady
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Is there an explanation for the =
following=20
behaviour:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd'" > =
aaa</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>file aaa will =
contain 'abcd'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>However if you run</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd';exit!" > =
aaa</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>file aaa will be empty.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>At the same time:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd';exit!" =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>will display 'abcd' on the =
screen.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>[x86.bison:9]gfb> ruby -v<BR>ruby =
1.6.8=20
(2002-12-24) [i386-solaris2.8]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Gennady.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>P.S. Same behaviour on =
Linux</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>[lnx.bear:54]bystr> ruby -v<BR>ruby =
1.6.8=20
(2002-12-24) [i686-linux]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0007_01C33CCA.E6B22200--
------=_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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Is there an explanation for the =
following=20
behaviour:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd'" > =
aaa</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>file aaa will =
contain 'abcd'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>However if you run</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd';exit!" > =
aaa</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>file aaa will be empty.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>At the same time:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ruby -e "puts 'abcd';exit!" =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>will display 'abcd' on the =
screen.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>[x86.bison:9]gfb> ruby -v<BR>ruby =
1.6.8=20
(2002-12-24) [i386-solaris2.8]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Gennady.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>P.S. Same behaviour on =
Linux</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>[lnx.bear:54]bystr> ruby -v<BR>ruby =
1.6.8=20
(2002-12-24) [i686-linux]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0007_01C33CCA.E6B22200--