@@ -107,6 +107,7 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
107107 new .Env .Merge (templater .ReplaceVars (e .Taskfile .Env , cache ), nil )
108108 new .Env .Merge (templater .ReplaceVars (dotenvEnvs , cache ), nil )
109109 new .Env .Merge (templater .ReplaceVars (origTask .Env , cache ), nil )
110+ new .Env .Merge (templater .ReplaceVars (call .Vars , cache ), nil )
110111 if evaluateShVars {
111112 err = new .Env .Range (func (k string , v ast.Var ) error {
112113 // If the variable is not dynamic, we can set it and return
@@ -126,6 +127,8 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
126127 }
127128 }
128129 envCache := new .Env .ToCacheMap ()
130+ // merge envCache with cache
131+ cache .MergeCacheMap (envCache )
129132
130133 if len (origTask .Cmds ) > 0 {
131134 new .Cmds = make ([]* ast.Cmd , 0 , len (origTask .Cmds ))
@@ -162,7 +165,7 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
162165 continue
163166 }
164167 newCmd := cmd .DeepCopy ()
165- newCmd .Cmd = templater .ReplaceWithExtra (cmd .Cmd , cache , envCache )
168+ newCmd .Cmd = templater .Replace (cmd .Cmd , cache )
166169 newCmd .Task = templater .Replace (cmd .Task , cache )
167170 newCmd .Vars = templater .ReplaceVars (cmd .Vars , cache )
168171 new .Cmds = append (new .Cmds , newCmd )
0 commit comments