Problem with running external process

Dan Sommers me at
Mon Jan 23 20:53:57 EST 2006

On 23 Jan 2006 10:03:28 -0800,
"ToMasz" <t_mo_info at> wrote:

> Yes, each time the process is created, it remains.  os.waitpid(-1,
> os.WNOHANG) doesn't work before starting the process for the first
> time.

Argh.  That's what I get for looking at my example too quickly.  ;-)

Of course:  the best place for os.waitpid is immediately *after*
starting a new process.  :-/

> I tried this:

> pid = os.fork()
> if pid == 0:
>       os.execl('','')
> else:
>       (pid,status) = os.waitpid(pid, 0)

> It seems to work without leaving zombies.

If your parent process just sits around and waits for each child process
to finish before moving on, why not use

    os.spawnl(os.P_WAIT, '')

instead of forking and execing "manually"?


Dan Sommers

More information about the Python-list mailing list