Title: Defunct when using subprocess.Popen

Hi!

I hope someone can help me out here!

I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched process. Every time I do so, I end up with the process as defunct. Can anybody help me clean it up in a nice way?

My code snippets:
#Launching a separate process (no communication in between the process needed)
# When closing the GUI, the launched program should not be killed.

command = ['test.py',' -c ',config]
process = subprocess.Popen(command, preexec_fn = os.setsid)

On request from GUI I do the following:
os.kill(process.pid,9)

FYI, it is all running on Linux.

All suggestions are appreciated!

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to