From efb51e4531bb76355a9126eb060fe5a01f2db2ca Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 31 Dec 2014 18:53:34 +0100 Subject: [PATCH] cleanup-mounts-under: Don't fail when /proc/mounts isn't readable Not all operating systems provide a "/proc/mounts" file (for exmaple, Darwin/OS X doesn't), so ignore this error for now ... This doesn't solve the problem per se but makes "make clean" usable on those systems again. Signed-off-by: Alexander Barton --- t/cleanup-mounts-under | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/cleanup-mounts-under b/t/cleanup-mounts-under index a8ba611..8f766c3 100755 --- a/t/cleanup-mounts-under +++ b/t/cleanup-mounts-under @@ -17,11 +17,17 @@ targets = sys.argv[1:] exit_status = 0 for target in targets: if not os.path.isdir(target): - print >> sys.stderr, target, 'is not a directory' + print >> sys.stderr, target, 'is not a directory!' exit_status = 1 continue + top = os.path.realpath(target) - proc_mounts = open('/proc/mounts', 'r') + try: + proc_mounts = open('/proc/mounts', 'r') + except IOError: + print >> sys.stdout, 'Cannot open /proc/mounts!' + sys.exit(1) + for line in proc_mounts: _, point, fstype, _ = line.split(' ', 3) point = mntent_unescape(point) -- 2.39.2