mirror of
https://github.com/go-task/task.git
synced 2026-06-30 16:14:19 +00:00
Add a per-command `timeout` option that terminates a command once it exceeds the given duration, preventing commands from hanging indefinitely in a pipeline. Uses Go duration syntax (e.g. 30s, 5m, 1h30m) and applies to both shell commands and task calls. Closes #1569
30 lines
591 B
YAML
30 lines
591 B
YAML
version: '3'
|
|
|
|
tasks:
|
|
timeout-exceeded:
|
|
desc: Command that should timeout
|
|
cmds:
|
|
- cmd: sleep 10
|
|
timeout: 1s
|
|
|
|
timeout-not-exceeded:
|
|
desc: Command that completes within timeout
|
|
cmds:
|
|
- cmd: echo "quick command"
|
|
timeout: 5s
|
|
|
|
no-timeout:
|
|
desc: Command with no timeout specified
|
|
cmds:
|
|
- echo "no timeout"
|
|
|
|
multiple-cmds-timeout:
|
|
desc: Multiple commands where one exceeds its timeout
|
|
cmds:
|
|
- cmd: echo "first"
|
|
timeout: 1s
|
|
- cmd: sleep 10
|
|
timeout: 1s
|
|
- cmd: echo "third"
|
|
timeout: 1s
|