From 2c0dfe6771b9d0fb71afe69d7e2c20cc4662fda3 Mon Sep 17 00:00:00 2001 From: Simon Stelling Date: Tue, 2 May 2006 17:54:19 +0000 Subject: catch ENOENT and ENOTDIR in clean_locks to prevent ugly tracebacks; bug 124164 svn path=/main/trunk/; revision=3309 --- bin/clean_locks | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/clean_locks b/bin/clean_locks index 947f72756..2a3f06d22 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/clean_locks,v 1.1 2004/09/26 10:44:31 carpaski Exp $ -import os,sys +import os,sys,errno sys.path = ["/usr/lib/portage/pym"]+sys.path import portage_locks @@ -28,6 +28,14 @@ if "--force" in sys.argv[1:]: for x in sys.argv[1:]: if x == "--force": continue - for y in portage_locks.hardlock_cleanup(x, remove_all_locks=force): - print y - print + try: + for y in portage_locks.hardlock_cleanup(x, remove_all_locks=force): + print y + print + + except OSError, e: + if e.errno in (errno.ENOENT, errno.ENOTDIR): + print "!!! %s is not a directory or does not exist" % x + else: + raise + sys.exit(e.errno) -- cgit v1.2.3-1-g7c22