module GClouderUndefinedResources::Shell

Public Class Methods

run(command) click to toggle source
# File lib/gclouder_undefined_resources/shell.rb, line 5
def self.run(command)
  puts "running command: #{command}" if CLIArgs.cli_args[:verbose]
  stdout, stderr, status = Open3.capture3(command)

  if status.to_i.nonzero?
    raise StandardError, "command failed: #{command}\n#{stderr}\n#{stdout}"
  end

  stdout
rescue => error
  puts error
  exit 1
end