Class: EZAPIClient::ExecCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ezapi_client/services/exec_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(command) ⇒ Object



7
8
9
# File 'lib/ezapi_client/services/exec_command.rb', line 7

def self.call(command)
  self.new(command: command).()
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/ezapi_client/services/exec_command.rb', line 11

def call
  stdout_str, stderr_str, status = Open3.capture3(command)
  unless status.success?
    fail(ArgumentError, "Error executing command: #{stderr_str}")
  end
  stdout_str.chomp
end