Merge "service: fix service alive checking"
This commit is contained in:
commit
6cb9b88f09
@ -109,13 +109,10 @@ class ServiceRestartTest(base.BaseTestCase):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _check_process_alive(pid):
|
def _check_process_alive(pid):
|
||||||
try:
|
try:
|
||||||
with open("/proc/%d/status" % pid) as fd_proc:
|
os.kill(pid, 0)
|
||||||
for line in fd_proc.readlines():
|
except OSError:
|
||||||
if line.startswith("State:"):
|
|
||||||
state = line.split(":", 1)[1].strip().split(' ')[0]
|
|
||||||
return state not in ['Z', 'T', 'Z+']
|
|
||||||
except IOError:
|
|
||||||
return False
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def check_process_alive(self):
|
def check_process_alive(self):
|
||||||
cond = lambda: self._check_process_alive(self.sub.pid)
|
cond = lambda: self._check_process_alive(self.sub.pid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user