1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

Switch variable replacing with Go's template engine

This commit is contained in:
Andrey Nering
2017-03-05 16:49:44 -03:00
parent 6368c2fdb6
commit 91d5fa5fe6
2 changed files with 33 additions and 13 deletions

20
task.go
View File

@@ -89,7 +89,11 @@ func RunTask(name string) error {
}
for _, d := range t.Deps {
if err := RunTask(ReplaceVariables(d, vars)); err != nil {
d, err = ReplaceVariables(d, vars)
if err != nil {
return err
}
if err = RunTask(d); err != nil {
return err
}
}
@@ -130,11 +134,15 @@ func (t *Task) runCommand(i int) error {
if err != nil {
return err
}
var (
c = ReplaceVariables(t.Cmds[i], vars)
dir = ReplaceVariables(t.Dir, vars)
cmd *exec.Cmd
)
c, err := ReplaceVariables(t.Cmds[i], vars)
if err != nil {
return err
}
dir, err := ReplaceVariables(t.Dir, vars)
if err != nil {
return err
}
var cmd *exec.Cmd
if ShExists {
cmd = exec.Command(ShPath, "-c", c)
} else {