From: YANAGAWA Kazuhisa Date: 2003-06-28T11:47:42+09:00 Subject: Re: exit! affects stdout redirection to a file In Message-Id: <000a01c33d05$933e4b90$c20ca8c0@gfb> "Gennady" writes: > 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. Not so since exit! calls _exit() in C level, which is expected to behave such way. Namely exit! is prepared for a occasion to exit as soon as possible, without extra cleaning up. Note stdio associated with a terminal is set to a line oriented buffering mode and puts outputs a line. > ruby -v ruby 1.7.2 (2002-05-07) [i386-freebsd] > ruby -e 'puts "abcd"; exit!' abcd > ruby -e 'print "abcd"; exit!' > ruby -e 'print "abcd\n"; exit!' abcd That's all. Tty flushes a buffer when it sees a `\n'. # tty(4), termios(4) ? -- kjana@dm4lab.to June 28, 2003 It is comparison that makes men happy or miserable.