Prevents files to be used as input of dagger.#FS
Errors out in the PreRun phase of the clientfilesystemreader task since otherwise, dagger execution would hang Fixes #1977 Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
@@ -18,8 +18,7 @@ func init() {
|
||||
Register("ClientFilesystemRead", func() Task { return &clientFilesystemReadTask{} })
|
||||
}
|
||||
|
||||
type clientFilesystemReadTask struct {
|
||||
}
|
||||
type clientFilesystemReadTask struct{}
|
||||
|
||||
func (t clientFilesystemReadTask) PreRun(_ context.Context, pctx *plancontext.Context, v *compiler.Value) error {
|
||||
path, err := t.parsePath(v)
|
||||
@@ -27,8 +26,10 @@ func (t clientFilesystemReadTask) PreRun(_ context.Context, pctx *plancontext.Co
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
|
||||
if pi, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
|
||||
return fmt.Errorf("path %q does not exist", path)
|
||||
} else if !pi.IsDir() && plancontext.IsFSValue(v.Lookup("contents")) {
|
||||
return fmt.Errorf("path %q is not a directory", path)
|
||||
}
|
||||
|
||||
if plancontext.IsFSValue(v.Lookup("contents")) {
|
||||
|
Reference in New Issue
Block a user