How to tell if a forked process is done?
John Lin
joseph at ugcs.caltech.edu
Tue Sep 23 19:47:40 EDT 2003
Howdy,
I want to know how to tell if a forked process is done.
Actually, my real question is that I want to run a shell script inside
of a python script, and after the shell script has finished running, I
want to do more stuff *condition* on the fact that the shell script
has finished running, inside the same python script.
The only way I can think of is to fork a process and then call the
shell script, as in:
pid = os.fork()
if pid == 0:
os.execl(shellscript_name.sh, "")
but how can I know if the shell script is finished?
In sum, my two questions are:
1. How can I know if a forked shell script is finished?
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?
thanks in advance,
John
More information about the Python-list
mailing list