Sha256: 2c9899cb4931f2b3fd1218d7b3eeb54691d6b9ab7c092aad28577be684885099
Contents?: true
Size: 736 Bytes
Versions: 3
Compression:
Stored size: 736 Bytes
Contents
module Lono::Utils module Sh def sh(command, options={}) on_fail = options[:on_fail].nil? ? "raise" : options[:on_fail] strategy = options[:strategy].nil? ? "system" : options[:strategy] # system or backticks logger.info "=> #{command}" if strategy == "backticks" out = `#{command}` logger.debug out success = $?.success? else success = system(command) end result = strategy == "backticks" ? out : success return result if success logger.error "ERROR: Running #{command}" case on_fail.to_sym when :raise raise when :exit status = $?.exitstatus exit status end result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lono-8.0.0.pre.rc6 | lib/lono/utils/sh.rb |
lono-8.0.0.pre.rc5 | lib/lono/utils/sh.rb |
lono-8.0.0.pre.rc4 | lib/lono/utils/sh.rb |