Skip to content

Commit 141b377

Browse files
committed
Partly revert 59d2733
Keep the old behavior on v2
1 parent 402a478 commit 141b377

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

internal/compiler/v2/compiler_v2.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"path/filepath"
87
"strings"
98
"sync"
109

@@ -38,16 +37,8 @@ type CompilerV2 struct {
3837
// 4. Taskvars file variables
3938
// 5. Environment variables
4039
func (c *CompilerV2) GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) {
41-
// NOTE(@andreynering): We're manually joining these paths here because
42-
// this is the raw task, not the compiled one.
43-
dir := t.Dir
44-
if !filepath.IsAbs(dir) {
45-
dir = filepath.Join(c.Dir, dir)
46-
}
47-
4840
vr := varResolver{
4941
c: c,
50-
dir: dir,
5142
vars: compiler.GetEnviron(),
5243
}
5344
vr.vars.Set("TASK", taskfile.Var{Static: t.Task})
@@ -62,7 +53,6 @@ func (c *CompilerV2) GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfi
6253

6354
type varResolver struct {
6455
c *CompilerV2
65-
dir string
6656
vars *taskfile.Vars
6757
err error
6858
}
@@ -77,7 +67,7 @@ func (vr *varResolver) merge(vars *taskfile.Vars) {
7767
Static: tr.Replace(v.Static),
7868
Sh: tr.Replace(v.Sh),
7969
}
80-
static, err := vr.c.HandleDynamicVar(v, vr.dir)
70+
static, err := vr.c.HandleDynamicVar(v, "")
8171
if err != nil {
8272
vr.err = err
8373
return err
@@ -88,7 +78,7 @@ func (vr *varResolver) merge(vars *taskfile.Vars) {
8878
vr.err = tr.Err()
8979
}
9080

91-
func (c *CompilerV2) HandleDynamicVar(v taskfile.Var, dir string) (string, error) {
81+
func (c *CompilerV2) HandleDynamicVar(v taskfile.Var, _ string) (string, error) {
9282
if v.Static != "" || v.Sh == "" {
9383
return v.Static, nil
9484
}
@@ -106,7 +96,6 @@ func (c *CompilerV2) HandleDynamicVar(v taskfile.Var, dir string) (string, error
10696
var stdout bytes.Buffer
10797
opts := &execext.RunCommandOptions{
10898
Command: v.Sh,
109-
Dir: dir,
11099
Stdout: &stdout,
111100
Stderr: c.Logger.Stderr,
112101
}

0 commit comments

Comments
 (0)