Class: Mj::Git::CommandExecuter

Inherits:
Object
  • Object
show all
Defined in:
lib/mj/git/command_executer.rb

Constant Summary collapse

Error =
Class.new(RuntimeError)

Instance Method Summary collapse

Instance Method Details

#execute(command) ⇒ Object

Raises:



10
11
12
13
14
15
16
17
18
# File 'lib/mj/git/command_executer.rb', line 10

def execute(command)
  stdout_str, stderr_str, status = Open3.capture3(command)

  if status.success?
    return stdout_str.split("\n")
  end

  raise Error, "Command '#{command}' exited with (#{status.exitstatus}): #{stderr_str.strip}"
end