Module: Terraspace::Util::Sh
- Included in:
- Terraspace::Util
- Defined in:
- lib/terraspace/util/sh.rb
Instance Method Summary collapse
-
#sh(command, options = {}) ⇒ Object
requires @mod to be set.
Instance Method Details
#sh(command, options = {}) ⇒ Object
requires @mod to be set
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/terraspace/util/sh.rb', line 4 def sh(command, ={}) exit_on_fail = [:exit_on_fail].nil? ? true : [:exit_on_fail] env = [:env] || {} env.stringify_keys! logger.info "=> #{command}" return if ENV['TS_TEST'] success = system(env, command, chdir: @mod.cache_dir) unless success logger.info "Error running command: #{command}".color(:red) exit $?.exitstatus if exit_on_fail end end |