Kick off a delete command from python and not wait

Nobody nobody at nowhere.com
Tue Jul 20 17:44:11 EDT 2010


On Tue, 20 Jul 2010 10:32:12 -0700, Chris Rebert wrote:

> I believe you need to /eventually/ call .wait() as shown to avoid the
> child becoming a zombie process.

Alternatively, you can call .poll() periodically. This is similar to
.wait() insofar as it will "reap" the process if it has terminated, but
unlike .wait(), .poll() won't block if the process is still running.

On Unix, you can use os.fork(), have the child execute the command in the
background, and have the parent wait for the child with os.wait(). The
child will terminate as soon as it has spawned the grandchild, and the
grandchild will be reaped automatically upon termination (so you can
forget about it).





More information about the Python-list mailing list