3.11: runwatch

This commit is contained in:
enkore 2013-03-10 18:24:42 +01:00
parent 7dfac95f1e
commit 8abc7dd8e8

View File

@ -28,10 +28,16 @@ class RunWatch(IntervalModule):
return os.path.exists("/proc/{pid}/".format(pid=pid))
def run(self):
with open(glob.glob(self.path)[0], "r") as f:
pid = int(f.read().strip())
alive = False
pid = 0
try:
with open(glob.glob(self.path)[0], "r") as f:
pid = int(f.read().strip())
alive = self.is_process_alive(pid)
except Exception:
pass
if self.is_process_alive(pid):
if alive:
fmt = self.format_up
color = self.color_up
else: