File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,14 +85,22 @@ def check_services(service_name):
8585 """
8686 check to see if certain services ar started
8787 """
88- all_processes = set ()
89- for pid in psutil .pids ():
90- running_proc = psutil .Process (pid )
91- all_processes .add (" " .join (running_proc .cmdline ()).strip ())
92- for proc in list (all_processes ):
93- if service_name in proc :
94- return True
95- return False
88+ try :
89+ all_processes = set ()
90+ for pid in psutil .pids ():
91+ running_proc = psutil .Process (pid )
92+ all_processes .add (" " .join (running_proc .cmdline ()).strip ())
93+ for proc in list (all_processes ):
94+ if service_name in proc :
95+ return True
96+ return False
97+ except psutil .ZombieProcess as e :
98+ # zombie processes appear to happen on macOS for some reason
99+ # so we'll just kill them off
100+ pid = str (e ).split ("=" )[- 1 ].split (")" )[0 ]
101+ os .kill (int (pid ), 0 )
102+ return True
103+
96104
97105
98106def write_to_file (data_to_write , filename , mode = "a+" ):
You can’t perform that action at this time.
0 commit comments