This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Process in not get killed using subprocess.call() in python thread
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: djc, gvanrossum, lars.gustaebel, lemburg, pedronis, terry.reedy
Priority: normal Keywords:

Created on 2017-07-13 15:20 by sanky8793, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg298288 - (view) Author: Sanket (sanky8793) Date: 2017-07-13 15:20
import threading
import subprocess

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


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




In above code,  process with name "shell" have to killed,  but its not working. While same when I do in simple without thread,  its working
msg298290 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2017-07-13 15:36
Please find a list like python-list (comp.lang.python) to ask for help with your problem.

Also please stop adding people to the nosy list.
History
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75104
2017-07-13 15:36:03gvanrossumsetstatus: open -> closed

messages: + msg298290
stage: resolved
2017-07-13 15:34:18sanky8793setnosy: + terry.reedy
2017-07-13 15:31:21sanky8793setnosy: + lemburg, pedronis, lars.gustaebel
2017-07-13 15:29:56sanky8793setnosy: + gvanrossum, djc, - sanky8793
2017-07-13 15:20:18sanky8793create