Windows fix for directory crawling
This commit is contained in:
@@ -81,16 +81,8 @@ func doList(clnt client.Client, recursive bool) error {
|
||||
console.Errorln(iodine.ToError(contentCh.Err))
|
||||
continue
|
||||
}
|
||||
switch err := iodine.ToError(contentCh.Err).(type) {
|
||||
case *os.PathError:
|
||||
if err.Op == "readlink" {
|
||||
console.Errorln(iodine.ToError(contentCh.Err))
|
||||
continue
|
||||
}
|
||||
}
|
||||
err = contentCh.Err
|
||||
break
|
||||
|
||||
}
|
||||
console.Println(parseContent(contentCh.Content))
|
||||
}
|
||||
|
||||
+3
-10
@@ -231,18 +231,11 @@ func (f *fsClient) listInRoutine(contentCh chan client.ContentOnChannel) {
|
||||
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||
fi, err = os.Stat(filepath.Join(dir.Name(), fi.Name()))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) { // return proper error on broken symlinks
|
||||
contentCh <- client.ContentOnChannel{
|
||||
Content: nil,
|
||||
Err: iodine.New(err, map[string]string{"Target": file.Name()}),
|
||||
}
|
||||
return
|
||||
}
|
||||
contentCh <- client.ContentOnChannel{
|
||||
Content: nil,
|
||||
Err: iodine.New(err, nil),
|
||||
Err: iodine.New(err, map[string]string{"Target": file.Name()}),
|
||||
}
|
||||
return
|
||||
continue
|
||||
}
|
||||
}
|
||||
if fi.Mode().IsRegular() || fi.Mode().IsDir() {
|
||||
@@ -297,7 +290,7 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan client.ContentOnChannel
|
||||
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||
fi, err = os.Stat(fp)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) { // ignore broken symlinks
|
||||
if os.IsNotExist(err) || os.IsPermission(err) { // ignore broken symlinks and permission denied
|
||||
return nil
|
||||
}
|
||||
return iodine.New(err, nil)
|
||||
|
||||
Reference in New Issue
Block a user