executing an external program
Martin v. Löwis
loewis at informatik.hu-berlin.de
Mon Apr 8 06:51:18 EDT 2002
mixo <mixo at beth.uniforum.org.za> writes:
> How can I continue execution of my script, and run only one instance
> of the external program and keep track of what is doing so as to
> avoid confusion?
On Unix, you can use os.fork/os.exec to create the subprocess
asynchronously. You can then use os.wait to wait for the completion of
the child process when you want to start the next process. For that,
you have three modi operandi:
1. you invoke wait blockingly.
2. you invoke wait non-blockingly, and operate in a polling fashiong.
3. you install a SIGCLD handler, and start the next process when the
previous one terminates.
HTH,
Martin
More information about the Python-list
mailing list