]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
misc/cpu-watcher.tac: tolerate missing pidfiles, just skip over that sample
authorBrian Warner <warner@lothar.com>
Thu, 7 Aug 2008 04:17:05 +0000 (21:17 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 7 Aug 2008 04:17:05 +0000 (21:17 -0700)
misc/cpu-watcher.tac

index 4992a1c415da41fc8ed0594b6727d913833933d8..4546454e0dc459464758bdbbc411f500412779be 100644 (file)
@@ -57,14 +57,19 @@ def read_pids_txt():
             name = parts[1]
         else:
             name = pidthing
+        pid = None
         try:
             pid = int(pidthing)
         except ValueError:
             pidfile = os.path.expanduser(pidthing)
             if os.path.isdir(pidfile):
                 pidfile = os.path.join(pidfile, "twistd.pid")
-            pid = int(open(pidfile, "r").read().strip())
-        processes.append( (pid, name) )
+            try:
+                pid = int(open(pidfile, "r").read().strip())
+            except EnvironmentError:
+                pass
+        if pid is not None:
+            processes.append( (pid, name) )
     return processes
 
 Averages = ListOf( TupleOf(str, float, float, float) )