'before_fork' is executed in parallel by two processes ¿?

Iñaki Baz Castillo ibc at aliax.net
Thu Jan 7 10:26:49 EST 2010

El Martes, 5 de Enero de 2010, Eric Wong escribió:
> >   before_fork do |server, worker|
> >     `echo "before_fork $$" >> /tmp/kk`
> >      File.open("/tmp/kk", "a") do |f|
> >        f.puts "$$=#{$$}"
> >      end
> >   end
> Odd, I'm confused by the way `` is working there too...  I wonder if
> this is a Ruby bug...  Anyhow, in your use case system() or your
> File.open block should be the way to go.  Don't use `` when system()
> will do.

I think that the above makse sense since `` creates a new process (with its 
own pid). So each time it's called (once per worker) it will be a different 

Iñaki Baz Castillo <ibc at aliax.net>

More information about the mongrel-unicorn mailing list