lib/eco-rake/shell/command.rb in eco-rake-0.2.6 vs lib/eco-rake/shell/command.rb in eco-rake-0.2.7

- old
+ new

@@ -30,10 +30,11 @@ # @param continue [Boolean] whether it should continue when one failed. # @param arr [Array<String>] array of commands to be run def sh_chain(cmds, continue: false, &block) cmds.each do |cmd| next sh(cmd, &block) unless continue + ch_continue(cmd, &block) end end # It **continues** even if there was an error or `exit(1)` during the execution @@ -58,13 +59,15 @@ # @note it wraps `block` if given # @return [Proc] def sh_default_block(comm) proc do |ok, res| yield(ok, res) if block_given? + unless ok msg = "Command failed (status = #{res.exitstatus})" puts "#{msg}\n • #{comm}" end + res.exitstatus end end def middlewared_callback(original)