From 7feceeae878dd4535ffdf12db6cc69d9bee5e70a Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Sat, 2 Dec 2023 02:26:08 +0000 Subject: [PATCH] fix: handle errors when sh is used in Taskfiles with the any variables experiment enabled --- task.go | 4 ++-- variables.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/task.go b/task.go index d43b1f80..1ec9adfd 100644 --- a/task.go +++ b/task.go @@ -478,8 +478,8 @@ func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*taskfile.Task, error) task := tasks[idx] g.Go(func() error { compiledTask, err := e.FastCompiledTask(taskfile.Call{Task: task.Task}) - if err == nil { - task = compiledTask + if err != nil { + return err } tasks[idx] = compiledTask return nil diff --git a/variables.go b/variables.go index 21da2315..b7071c3d 100644 --- a/variables.go +++ b/variables.go @@ -169,6 +169,11 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf } case []any: list = value + case map[string]any: + return &taskfile.Task{}, errors.TaskfileInvalidError{ + URI: origTask.Location.Taskfile, + Err: errors.New("sh is not supported with the 'Any Variables' experiment enabled.\nSee https://taskfile.dev/experiments/any-variables for more information."), + } default: return nil, errors.TaskfileInvalidError{ URI: origTask.Location.Taskfile,