I have created one thread in python, and that thread is running in infinite 
loop, but when I was trying to kill a process by making use of 
subprocess.call("my ps command") Its not actually working

Here is the code,




import threading
import subprocess

def B():
    while True:
        cmd="ps -ef | grep 'shell.py --server' | awk '{print $2}' | xargs kill 
-9"
        subprocess.call(cmd, shell=True)


def A():
    th = threading.Thread(target=B)
    th.start()





In above example, subprocess.call() getting executed but not actually killing 
the process that I want. If I executed command manually then its working fine, 
but in thread its not.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to