Skip to content

Conversation

@lox
Copy link

@lox lox commented Oct 24, 2025

Summary

Add command-level timeout support to prevent commands from hanging indefinitely in task pipelines.

Closes #1569

Usage

version: '3'

tasks:
  deploy:
    cmds:
      - cmd: npm run build
        timeout: 5m

      - cmd: ./deploy.sh
        timeout: 30m

Commands exceeding their timeout are terminated:

task: Failed to run task "deploy": task: [deploy] command timeout exceeded (5m): context deadline exceeded

Implementation Details

  • Timeout applies per command, not per task
  • Works with both shell commands and task calls
  • Deferred commands use separate context and run even if parent times out
  • ignore_error flag does not suppress timeout errors
  • Zero/unspecified timeout maintains current behavior (no timeout)

lox added 2 commits October 24, 2025 10:59
Add timeout field to Cmd struct to terminate commands that exceed
specified duration. Addresses use case from go-task#1569 where commands can
hang indefinitely in pipelines.

Usage:
  cmds:
    - cmd: ./script.sh
      timeout: 5m
Document the new timeout field for commands in both JSON schema
and reference documentation with examples.
@lox lox changed the title Feat/command timeout feat: Command timeouts Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeout for running tasks

1 participant