From 8abc7dd8e8c9bc495ba0b2e5ad1a6d00db2f01a8 Mon Sep 17 00:00:00 2001 From: enkore Date: Sun, 10 Mar 2013 18:24:42 +0100 Subject: [PATCH] 3.11: runwatch --- i3pystatus/runwatch.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/i3pystatus/runwatch.py b/i3pystatus/runwatch.py index 91ff048..5915e7e 100644 --- a/i3pystatus/runwatch.py +++ b/i3pystatus/runwatch.py @@ -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: