fix sjl/friendly-find#3, skip "permission denied"
author |
Tony Wang <wwwjfy@gmail.com> |
date |
Mon, 14 Apr 2014 14:40:33 +0800 |
parents |
799cd10dcfcf
|
children |
b9310be6f582
|
branches/tags |
(none) |
files |
ffind |
Changes
--- a/ffind Sun Mar 23 18:41:13 2014 +0800
+++ b/ffind Mon Apr 14 14:40:33 2014 +0800
@@ -189,7 +189,7 @@
# If you can't tell what the hell this means you're not alone, because git's
# documentation is fucking inscrutable. Here's what I've come up with from
# trial and error:
- #
+ #
# 0. Patterns ending in a slash will only match directories, and then you
# can ignore that slash for the rest of these rules.
# 1. Patterns are shell globs, except * doesn't match / and there's no **.
@@ -465,7 +465,11 @@
def _search(query, dir, depth, ignorers):
ignorers = ignorers + parse_ignore_files(dir) + parse_ignore_args()
- contents = os.listdir(dir)
+ try:
+ contents = os.listdir(dir)
+ except OSError:
+ err('Error: `' + dir + '`: Permission denied')
+ return
next = []
for item in contents: