Class: Tidewave::Tools::ShellEval

Inherits:
Base
  • Object
show all
Defined in:
lib/tidewave/tools/shell_eval.rb

Defined Under Namespace

Classes: CommandFailedError

Instance Method Summary collapse

Methods inherited from Base

file_system_tool, file_system_tool?

Instance Method Details

#call(command:) ⇒ Object

Raises:



30
31
32
33
34
35
# File 'lib/tidewave/tools/shell_eval.rb', line 30

def call(command:)
  stdout, status = Open3.capture2e(command)
  raise CommandFailedError, "Command failed with status #{status.exitstatus}:\n\n#{stdout}" unless status.exitstatus.zero?

  stdout.strip
end