How to tell if a forked process is done?

Jules Dubois bogus at invalid.tld
Wed Sep 24 03:51:48 CEST 2003


On 23 Sep 2003 16:47:40 -0700, in article
<879b6a51.0309231547.428214f7 at posting.google.com>, John Lin wrote:

> The only way I can think of is to fork a process and then call the
> shell script, as in:
>   pid = os.fork()
>[...]
> In sum, my two questions are:
> 1.  How can I know if a forked shell script is finished?

Under Unix, there's a wait() system call to go along with fork().  I'll bet
Python was something similar.

> 2.  How can I run a shell script inside a python script without
> forking a new process, so that I can know the shell script is done
> from within the same python script?

Something like system()?




More information about the Python-list mailing list