Sha256: c82cc50996763f6f3a60fc30e91b73a6f9a316d8fab1d7a0ab6b90cd6d5dce43
Contents?: true
Size: 879 Bytes
Versions: 1
Compression:
Stored size: 879 Bytes
Contents
require 'open3' module Hillary module Shellable class ExecutionError < StandardError attr_reader :command, :output, :status def initialize(command, output, status) message = "#{command}\n"\ "#{output}\n"\ "status: #{status}" super(message) @command = command @output = output @status = status end end def shell(command, options = {}) binding.pry options = {ignore_errors: false, logger: Logger.new($stdout)}.merge(options) logger = options[:logger] logger.info(command) output = `#{command} 2>1` status = $? unless status.success? if options[:ignore_errors] logger.error(output) else raise ExecutionError.new(command, output, status.exitstatus) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hillary-0.0.1 | lib/hillary/shellable.rb |