lib/leap_cli/util.rb in leap_cli-1.5.6 vs lib/leap_cli/util.rb in leap_cli-1.6.2

- old
+ new

@@ -6,17 +6,25 @@ module LeapCli module Util extend self + @@exit_status = nil + ## ## QUITTING ## def exit_status(code=nil) - @exit_status = code if code - @exit_status + if !code.nil? + if code == 0 && @@exit_status.nil? + @@exit_status = 0 + else + @@exit_status = code + end + end + @@exit_status end # # quit and print help # @@ -28,10 +36,10 @@ # # exit with error code and with a message that we are bailing out. # def bail!(*message) if block_given? - LeapCli.log_level = 3 + LeapCli.set_log_level(3) yield elsif message log 0, *message end log 0, :bail, ""