[New-bugs-announce] [issue30921] Process in not get killed using subprocess.call() in python thread

Sanket report at bugs.python.org
Thu Jul 13 11:20:19 EDT 2017


New submission from Sanket:

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

----------
components: Library (Lib)
messages: 298288
nosy: sanky8793
priority: normal
severity: normal
status: open
title: Process in not get killed using subprocess.call() in python thread
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30921>
_______________________________________


More information about the New-bugs-announce mailing list