lib/rye/rap.rb in rye-0.8.19 vs lib/rye/rap.rb in rye-0.9.0

- old
+ new

@@ -18,11 +18,11 @@ # was executed by (Rye::Box or Rye::Set) attr_reader :obj # An array containing any STDERR output attr_reader :stderr - attr_reader :exit_code + attr_reader :exit_status # Only populated when calling via Rye::Shell attr_reader :pid attr_accessor :exit_signal # The command that was executed. @@ -30,18 +30,22 @@ # * +obj+ an instance of Rye::Box or Rye::Set # * +args+ anything that can sent to Array#new def initialize(obj, *args) @obj = obj - @exit_code = 0 + @exit_status = -1 @stderr = [] super *args end alias :box :obj alias :set :obj + def inspect + "[%s, %s, %s, %s]" % [self.join("").tr("\r", ''), @stderr.join("; ").tr("\r", ''), exit_status, exit_signal] + end + # Returns a reference to the Rye::Rap object (which # acts like an Array that contains the STDOUT from the # command executed over SSH). This is available to # maintain consistency with the stderr method. def stdout @@ -77,19 +81,19 @@ # # In JRuby, if +code+ is a Process::Status object, @pid will be # set to -1 (JRuby doesn't return the pid). # # Returns the exit code as an Integer. - def add_exit_code(code) + def add_exit_status(code) code = 0 if code.nil? if code.is_a?(Process::Status) - @exit_code = code.exitstatus.to_i + @exit_status = code.exitstatus.to_i @pid = Rye.sysinfo.vm == :java ? '-1' : code.pid else - @exit_code = code.to_i + @exit_status = code.to_i end end - def code; @exit_code; end + def code; @exit_status; end # Returns the first element if there's only the # one, an empty String if there's none. Returns # the value of self.join($/) otherwise. def to_s; self.join $/; end \ No newline at end of file