I try to terminate a subprocess pid if an string is in the output, but is not working. What is wrong ?
import subprocess
import shlex
if "PING" in subprocess.check_call(shlex.split("ping -c 10 gogole.com")):
subprocess.check_call(shlex.split("ping -c 10 gogole.com")).terminate()
Aucun commentaire:
Enregistrer un commentaire