469,951 Members | 2,398 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Process monitoring

Hey, I'm working on a Python program that will launch some other
non-Python process using os.spawn (in the os.P_NOWAIT mode) and then
basically wait for it to finish (while doing some other stuff in the
interim). Normally, the new process will signal that it's done by
writing to a file, but I'd like to also find out if the new process
died unexpectedly. Anyone know any preferrable ways to do this?

Greg Steffensen

Jul 19 '05 #1
2 1984
gsteff wrote:
Hey, I'm working on a Python program that will launch some other
non-Python process using os.spawn (in the os.P_NOWAIT mode) and then
basically wait for it to finish (while doing some other stuff in the
interim). Normally, the new process will signal that it's done by
writing to a file, but I'd like to also find out if the new process
died unexpectedly. Anyone know any preferrable ways to do this?

Greg Steffensen

If you're using 2.4, have a look at the subprocess module.

J
Jul 19 '05 #2
Thanks- subprocess was exactly what I needed. For anyone else that
reads this, I just launched a new subprocess via subprocess.Popen, did
what I needed to do in a while look, while calling the poll method of
the Popen object to check whether it was finished, and if so, what its
error code was. Pretty simple.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ralf Gross | last post: by
12 posts views Thread by Raymond Lewallen | last post: by
6 posts views Thread by Laser Lu | last post: by
4 posts views Thread by Paddy | last post: by
1 post views Thread by nasha | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.