Class: Ask::Tools::Bash
- Inherits:
-
Ask::Tool
- Object
- Ask::Tool
- Ask::Tools::Bash
- Defined in:
- lib/ask/tools/shell/bash.rb
Overview
Execute shell commands in a sandboxed environment. Runs via Ask::Sandbox.provider (Local by default, configurable for stronger isolation via Docker, Daytona, or Cloudflare).
Instance Method Summary collapse
Instance Method Details
#execute(command:, timeout: 30, workdir: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ask/tools/shell/bash.rb', line 19 def execute(command:, timeout: 30, workdir: nil) result = Ask::Sandbox.provider.call( command, timeout: timeout, workdir: workdir ) if result.timed_out return Ask::Result.error( message: "Command timed out", metadata: { stdout: result.stdout, stderr: result.stderr } ) end Ask::Result.ok(data: { stdout: result.stdout, stderr: result.stderr, exit_code: result.exit_code, timed_out: result.timed_out }) end |