mirror of
https://github.com/go-task/task.git
synced 2025-11-27 22:38:20 +02:00
fix: dynamic vars break with for because of fast-compiled tasks
This commit is contained in:
@@ -156,6 +156,10 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
|
||||
if cmd.For.Var != "" {
|
||||
if vars != nil {
|
||||
v := vars.Get(cmd.For.Var)
|
||||
// If the variable is dynamic, then it hasn't been resolved yet
|
||||
// and we can't use it as a list. This happens when fast compiling a task
|
||||
// for use in --list or --list-all etc.
|
||||
if v.Value != nil && v.Sh == "" {
|
||||
switch value := v.Value.(type) {
|
||||
case string:
|
||||
if cmd.For.Split != "" {
|
||||
@@ -173,6 +177,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Name the iterator variable
|
||||
var as string
|
||||
if cmd.For.As != "" {
|
||||
|
||||
Reference in New Issue
Block a user