Skip to content

[Feature Idea] Timeout & Retry #33

Description

@albertalef

Problem: Commands can hang forever; flaky commands need manual retry logic.

Solution: Add _timeout and _retry options.

# Timeout after 5 seconds
sh do
  curl("https://slow-api.example.com", _timeout: 5)
end
# Raises RubyShell::TimeoutError

# Retry on failure
sh do
  curl("https://flaky-api.example.com",
       _retry: 3,                    # Max 3 attempts
       _retry_delay: 1,              # Wait 1 second between retries
       _retry_backoff: :exponential) # 1s, 2s, 4s delays
end

# Combine timeout and retry
sh do
  curl("https://api.example.com",
       _timeout: 10,
       _retry: 3,
       _retry_on: [RubyShell::TimeoutError, RubyShell::CommandError])
end

Implementation:

  • Add Timeout.timeout wrapper in TerminalExecutor.capture
  • Create retry loop with configurable delay/backoff
  • New RubyShell::TimeoutError exception class

Activity

  1. Repository owner locked and limited conversation to collaborators on Feb 5, 2026
  2. converted this issue into a discussion #54 on Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions