2013/4/3 Tanaka Akira <akr / fsij.org>:
> 2013/4/3 KOSAKI Motohiro <kosaki.motohiro / gmail.com>:
>>
>> I believe fork() should flush all IO objects automatically. 1) Why user
>> should know how ruby beffering? 2) fork() is not common method and
>> performance disadvantage is not much though.
>
> I see.  Agreed.

On second thought, I feel exit! is more essential solution.

Because there may be other objects which behaves as "flush at finalization",
flushing IO objects is not enough.

The problem is finalization is occur twice (at parent and child).
If ruby uses exit! for forked process, we can avoid dual finalization.

However it means users of fork must finalize objects explicitly in
forked process.
For example, fork { print "a" } may lost "a" because buffered "a" is
not flushed.
-- 
Tanaka Akira