How to get a PID of a child process from a process openden with Popen()

Miki Tebeka miki.tebeka at gmail.com
Fri Apr 8 10:43:41 EDT 2011


> 	p = subprocess.Popen(shlex.split("kdesu -u test program"))
> 
> How can I aquire the PID of the program which kdesu starts?
You can run "ps --ppid <p.pid>" and get the line containing test program.
The first field there should be the child process id.

HTH
--
Miki Tebeka <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com



More information about the Python-list mailing list