Module: Hillary::Shellable
- Included in:
- Slug
- Defined in:
- lib/hillary/shellable.rb
Defined Under Namespace
Classes: ExecutionError
Instance Method Summary collapse
Instance Method Details
#shell(command, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hillary/shellable.rb', line 21 def shell(command, = {}) = {ignore_errors: false, logger: Logger.new($stdout)}.merge() logger = [:logger] logger.debug(command) output = `#{command} 2>1` status = $? unless status.success? if [:ignore_errors] logger.error(output) else raise ExecutionError.new(command, output, status.exitstatus) end end end |