fix: add full error handling after os.Stat

Signed-off-by: Tanguy ⧓ Herrmann <tanguy@dagger.io>
This commit is contained in:
Tanguy ⧓ Herrmann 2022-04-04 13:32:19 +02:00
parent 67bcb7ca20
commit f18a2ce03a
No known key found for this signature in database
GPG Key ID: 0FE2C1C97F50F73B

View File

@ -35,6 +35,8 @@ func (t clientFilesystemReadTask) PreRun(_ context.Context, pctx *plancontext.Co
return fmt.Errorf("path %q is not a directory", path) return fmt.Errorf("path %q is not a directory", path)
case pi.IsDir() && !isFS: case pi.IsDir() && !isFS:
return fmt.Errorf("path %q cannot be a directory", path) return fmt.Errorf("path %q cannot be a directory", path)
case err != nil:
return fmt.Errorf("path %q cannot be stat'd", path)
} }
if plancontext.IsFSValue(v.Lookup("contents")) { if plancontext.IsFSValue(v.Lookup("contents")) {