From 465329a537b41fd3688db919694a2a67b52fd364 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Fri, 7 Jun 2024 11:55:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20implement=20missing=20Readdir=20?= =?UTF-8?q?for=20catfs=20(#4206)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- providers/os/connection/ssh/cat/cat_file.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/providers/os/connection/ssh/cat/cat_file.go b/providers/os/connection/ssh/cat/cat_file.go index b3efdf2991..3e81a2cdb6 100644 --- a/providers/os/connection/ssh/cat/cat_file.go +++ b/providers/os/connection/ssh/cat/cat_file.go @@ -88,7 +88,20 @@ func (f *File) ReadAt(b []byte, off int64) (n int, err error) { } func (f *File) Readdir(count int) (res []os.FileInfo, err error) { - return nil, errors.New("not implemented") + names, err := f.Readdirnames(count) + if err != nil { + return nil, err + } + + res = make([]os.FileInfo, len(names)) + for i, name := range names { + res[i], err = f.catfs.Stat(name) + if err != nil { + return nil, err + } + } + + return res, nil } func (f *File) Readdirnames(n int) (names []string, err error) {