“wie man subprocess.All in Python beendet” Code-Antworten

Stoppen Sie einen Subprozess -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

wie man subprocess.All in Python beendet

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

Ähnliche Antworten wie “wie man subprocess.All in Python beendet”

Fragen ähnlich wie “wie man subprocess.All in Python beendet”

Weitere verwandte Antworten zu “wie man subprocess.All in Python beendet” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen