Jarkko Laiho <jarkko.la...@iki.fi> wrote:

> On Sun, Mar 15, 2009 at 9:13 PM, Bill Janssen <jans...@parc.com> wrote:
> > You need to do an "exec" after doing a "fork".  /usr/bin/python on OS X
> > is a "framework build", and some (most?) of the OS X frameworks just
> > don't work after doing a fork.  You have to restart with an "exec".
> 
> All right, but how is this done?
> 
> I'll refer to the code I'm using:
> 
> http://code.activestate.com/recipes/278731/
> 
> The first fork happens at line 55, and the second at line 103. As
> said, I really don't understand this fork/exec business so I don't
> know what I should do. Which of the many exec* functions in the os
> module should I run, and with what parameters? The forking without
> exec already does everything I need it to do daemonizing-wise (except
> satisfy CoreFoundation), so what am I trying to accomplish? What does
> CF actually require me to do, and does it mess up or require further
> changes in the forking methodology I'm using?

So, that recipe is inadequate on OS X -- you pretty much have to do an
exec after the fork.  Doesn't matter which of the exec functions you
use -- use the most convenient one.  What you're trying to accomplish
is re-initialization of some of the memory structures of your process.

http://en.wikipedia.org/wiki/Fork-exec

Bill
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to