First Process Of Python Popen Pipe Can't Be Killed
I am using this code p1 = Popen(['rtmpdump'] + cmd_args.split(' '), stdout=PIPE) p2 = Popen(player_cmd.split(' '), stdin=p1.stdout, stderr=PIPE) p2.wait() # try to kill rtmpdump #
Solution 1:
Here is the fix. call wait()
after kill()
to really kill the zombie process
# kill the zombie rtmpdump
try:
p1.kill()
p1.wait()
except AttributeError:
# if we use python 2.5
from signal import SIGKILL
from os import kill, waitpid
kill(p1.pid, SIGKILL)
waitpid(p1.pid, 0)
Post a Comment for "First Process Of Python Popen Pipe Can't Be Killed"