1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

fix: forward env to RunCommand when evaluating sh vars (#1869)

* forward env to RunCommand when evaluating sh vars. fixes #1742

* feat: added tests

* fix: test

---------

Co-authored-by: Pete Davison <pd93.uk@outlook.com>
This commit is contained in:
rohm1
2025-01-02 21:07:25 +01:00
committed by GitHub
parent fe9f489702
commit 24a830e384
5 changed files with 23 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/joho/godotenv"
"github.com/go-task/task/v3/errors"
"github.com/go-task/task/v3/internal/env"
"github.com/go-task/task/v3/internal/execext"
"github.com/go-task/task/v3/internal/filepathext"
"github.com/go-task/task/v3/internal/fingerprint"
@ -115,7 +116,7 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
new.Env.Set(k, ast.Var{Value: v.Value})
return nil
}
static, err := e.Compiler.HandleDynamicVar(v, new.Dir)
static, err := e.Compiler.HandleDynamicVar(v, new.Dir, env.GetFromVars(new.Env))
if err != nil {
return err
}