Class: Botiasloop::Tools::Shell
- Inherits:
-
Botiasloop::Tool
- Object
- RubyLLM::Tool
- Botiasloop::Tool
- Botiasloop::Tools::Shell
- Defined in:
- lib/botiasloop/tools/shell.rb
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#execute(command:) ⇒ Hash
Execute a shell command.
Methods inherited from Botiasloop::Tool
Instance Method Details
#execute(command:) ⇒ Hash
Execute a shell command
17 18 19 20 21 22 23 24 |
# File 'lib/botiasloop/tools/shell.rb', line 17 def execute(command:) stdout, stderr, status = Open3.capture3(command) Result.new(stdout, stderr, status.exitstatus).to_h rescue Errno::ENOENT => e raise Error, "Command not found: #{e.message}" rescue Errno::EACCES => e raise Error, "Permission denied: #{e.message}" end |