From: Joel VanderWerf Date: 2009-07-14T02:18:17+09:00 Subject: Re: Process.fork weirdness Gary Wright wrote: > You need to flush the output stream before forking so that the child > process doesn't get any buffered data. Otherwise, every time the child > process exits, it will flush the duplicate data out to the 'output.txt' > file. Huh, I never knew that. That's dangerous if the parent process is multithreaded, isn't it? Because even if the forking thread flushes all open files, other threads can keep filling buffers before the fork happens. In process.c, rb_f_fork() flushes stdout and stderr before forking, so at least these two buffers are protected from other ruby threads. It seems like there should be an option to flush everything. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407