programs exit?
Mark McEahern
marklists at mceahern.com
Fri Jan 18 18:04:23 EST 2002
More information about the Python-list mailing list
Fri Jan 18 18:04:23 EST 2002
- Previous message (by thread): programs exit?
- Next message (by thread): programs exit?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
maximilianscherr wrote:
> how can i know if a program i started from the script has exitted?
>
> by using spwanv() to start it? how exactly do i get to know this?
Short answer: os.waitpid()
Here's an example:
import os
def spawnCommand(command, args):
"""Spawn the command and return the process id."""
pid = os.spawnv(os.P_NOWAIT, command, args)
return pid
command = "ls"
args = ['foo']
pid = spawnCommand(command, args) # args is a list
result = os.waitpid(pid, 0)
// mark
- Previous message (by thread): programs exit?
- Next message (by thread): programs exit?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list