Class: LLM::Shell::Tools::System

Inherits:
Tool
  • Object
show all
Defined in:
lib/llm/shell/tools/system.rb

Instance Method Summary collapse

Methods inherited from Tool

description, function, inherited, lock, name, params

Methods included from Tool::Patch

#builtin?, #disable!, #enable!, #enabled?

Methods included from Tool::Param

#param

Instance Method Details

#call(command:) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/llm/shell/tools/system.rb', line 9

def call(command:)
  ro, wo = IO.pipe
  re, we = IO.pipe
  Process.wait Process.spawn(command, out: wo, err: we)
  [wo, we].each(&:close)
  {stderr: re.read, stdout: ro.read}
end