Carl J. Van Arsdall wrote:
simple approach: use subprocess.Pope n to fork off the external command,
then sleep for a short while, check if it's done, sleep a little longer
if it hasn't, etc. when you've waited long enough, use os.kill to kill
the process.
(if you want to terminate a function in your own program, you can use
the alarm signal. see e.g. http://code.activestate.com/recipes/307871/ )
</F>
I want to create a process that would "expire" if it didn't complete in
a set amount of time. I don't seem to see any timeout values to pass
os.system - does anyone know of a good way to do this?
So far all I can think of is some kind of watchdog thread - but that
seems like overkill to do such a simple thing.
a set amount of time. I don't seem to see any timeout values to pass
os.system - does anyone know of a good way to do this?
So far all I can think of is some kind of watchdog thread - but that
seems like overkill to do such a simple thing.
then sleep for a short while, check if it's done, sleep a little longer
if it hasn't, etc. when you've waited long enough, use os.kill to kill
the process.
(if you want to terminate a function in your own program, you can use
the alarm signal. see e.g. http://code.activestate.com/recipes/307871/ )
</F>