reload: Fix error if pidof not installed

This commit is contained in:
Dylan Araps 2019-02-02 21:07:28 +02:00
parent 984c7b640e
commit f88dca706f
No known key found for this signature in database
GPG Key ID: F635E931C2834999

View File

@ -5,6 +5,7 @@ import colorsys
import json import json
import logging import logging
import os import os
import shutil
import subprocess import subprocess
import sys import sys
@ -178,6 +179,9 @@ def disown(cmd):
def get_pid(name): def get_pid(name):
"""Check if process is running by name.""" """Check if process is running by name."""
if not shutil.which("pidof"):
return False
try: try:
subprocess.check_output(["pidof", "-s", name]) subprocess.check_output(["pidof", "-s", name])
except subprocess.CalledProcessError: except subprocess.CalledProcessError: