“como encerrar o subprocess.call in python” Respostas de código

Pare um subprocesso Python

import os
import signal
import subprocess

# The os.setsid() is passed in the argument preexec_fn so
# it's run after the fork() and before  exec() to run the shell.
pro = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
                       shell=True, preexec_fn=os.setsid) 

os.killpg(os.getpgid(pro.pid), signal.SIGTERM)  # Send the signal to all the process groups
Blue Barracuda

como encerrar o subprocess.call in python

import os
import signal
import subprocess

# The os.setsid() is passed in the argument preexec_fn so
# it's run after the fork() and before  exec() to run the shell.
pro = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
                       shell=True, preexec_fn=os.setsid) 

os.killpg(os.getpgid(pro.pid), signal.SIGTERM)  # Send the signal to all the process groups
Uptight Unicorn

Respostas semelhantes a “como encerrar o subprocess.call in python”

Perguntas semelhantes a “como encerrar o subprocess.call in python”

Mais respostas relacionadas para “como encerrar o subprocess.call in python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código