By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,830 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,830 IT Pros & Developers. It's quick & easy.

Re: Create a process with a "time to live"

P: n/a
Carl J. Van Arsdall wrote:
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.
simple approach: use subprocess.Popen 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. )


Aug 15 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.