mirror of
https://github.com/go-task/task.git
synced 2026-07-01 08:34:19 +00:00
feat: add command-level timeout support
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
This commit is contained in:
29
testdata/timeout/Taskfile.yml
vendored
Normal file
29
testdata/timeout/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
Reference in New Issue
Block a user