Get Pid Of Recursive Subprocesses
Scenario: subprocess created a subprocess and so on, how can i get it's pid? I used subprocess.popen to launch the first subprocess, for example word file, this word file generated
Solution 1:
Using psutil:
parent = psutil.Process(parent_pid)
children = parent.children()
# all child pids can be accessed using the pid attribute
child_pids = [p.pid for p in children]
Post a Comment for "Get Pid Of Recursive Subprocesses"