Process monitoring

G

gsteff

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
 
J

John Abel

gsteff said:
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
 
G

gsteff

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,211
Members
47,845
Latest member
vojosay

Latest Threads

Top