feat: command timeouts (#2898)

This commit is contained in:
Valentin Maerten
2026-08-11 22:09:25 +02:00
committed by GitHub
parent 993508c782
commit 37898d9102
21 changed files with 830 additions and 50 deletions

View File

@@ -1,6 +1,8 @@
package ast
import (
"time"
"go.yaml.in/yaml/v3"
"github.com/go-task/task/v3/errors"
@@ -8,10 +10,11 @@ import (
// Dep is a task dependency
type Dep struct {
Task string
For *For
Vars *Vars
Silent bool
Task string
For *For
Vars *Vars
Silent bool
Timeout time.Duration
}
func (d *Dep) DeepCopy() *Dep {
@@ -19,10 +22,11 @@ func (d *Dep) DeepCopy() *Dep {
return nil
}
return &Dep{
Task: d.Task,
For: d.For.DeepCopy(),
Vars: d.Vars.DeepCopy(),
Silent: d.Silent,
Task: d.Task,
For: d.For.DeepCopy(),
Vars: d.Vars.DeepCopy(),
Silent: d.Silent,
Timeout: d.Timeout,
}
}
@@ -39,14 +43,22 @@ func (d *Dep) UnmarshalYAML(node *yaml.Node) error {
case yaml.MappingNode:
var taskCall struct {
Task string
For *For
Vars *Vars
Silent bool
Task string
For *For
Vars *Vars
Silent bool
Timeout string
}
if err := node.Decode(&taskCall); err != nil {
return errors.NewTaskfileDecodeError(err, node)
}
if taskCall.Timeout != "" {
timeout, err := parseTimeout(taskCall.Timeout, node)
if err != nil {
return err
}
d.Timeout = timeout
}
d.Task = taskCall.Task
d.For = taskCall.For
d.Vars = taskCall.Vars