K
klappnase
Hello, everyone,
I am running python2.2.2 on a linux box.
I want to call a shell command and get the PID of this child process
so I have the possibility to abort the child process while it is still
running.
I tried the popen2 module for that:
self.pp = popen2.Popen3(cmd)
cmdpid = self.pp.pid
However I found that the PID returned by self.pp.pid is not the PID of
the process of interest, but the PID of a subshell in which this child
process is running.
So if I do
os.kill(cmdpid, 9)
the subshell is killed, but the process I actually wanted to stop is
happily running on.
Does anyone have a clue what to do about that? Any help would be very
appreciated.
Thank you in advance
Michael
I am running python2.2.2 on a linux box.
I want to call a shell command and get the PID of this child process
so I have the possibility to abort the child process while it is still
running.
I tried the popen2 module for that:
self.pp = popen2.Popen3(cmd)
cmdpid = self.pp.pid
However I found that the PID returned by self.pp.pid is not the PID of
the process of interest, but the PID of a subshell in which this child
process is running.
So if I do
os.kill(cmdpid, 9)
the subshell is killed, but the process I actually wanted to stop is
happily running on.
Does anyone have a clue what to do about that? Any help would be very
appreciated.
Thank you in advance
Michael