Merge pull request #406 from WillEccles/pidof-mac-fix

Fixed pidof invalid argument on Mac OS
This commit is contained in:
black 2019-04-30 12:02:28 +03:00 committed by GitHub
commit e7d956ca18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import os
import shutil
import subprocess
import sys
import platform
class Color:
@ -183,7 +184,11 @@ def get_pid(name):
return False
try:
subprocess.check_output(["pidof", "-s", name])
if platform.system() != 'Darwin':
subprocess.check_output(["pidof", "-s", name])
else:
subprocess.check_output(["pidof", name])
except subprocess.CalledProcessError:
return False