From: Paul Wise Date: Tue, 6 Jan 2015 14:53:24 +0000 (+0800) Subject: Skip processes that no longer exist X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=1ddab772e371ab1852cbaaac848db479b5ef6f24;p=mirror%2Fdsa-puppet.git Skip processes that no longer exist --- diff --git a/modules/buildd/files/buildd-schroot-aptitude-kill b/modules/buildd/files/buildd-schroot-aptitude-kill index 74c4a02f5..9a4d72092 100755 --- a/modules/buildd/files/buildd-schroot-aptitude-kill +++ b/modules/buildd/files/buildd-schroot-aptitude-kill @@ -44,7 +44,13 @@ for p in psutil.process_iter(): if parent is None: continue if parent.name != 'schroot': continue # - rootdir = os.readlink('/proc/%d/root'%(p.pid,)) + try + rootdir = os.readlink('/proc/%d/root'%(p.pid,)) + except OSError as e: + if e.errno == errno.ENOENT: + continue + else: + raise e if not rootdir.startswith('/var/lib/schroot/mount'): continue # used = p.get_memory_info().vms