class RVM::Shell::Result
Represents the output of a shell command. This includes the exit status (and the helpful successful?
method) as well accessors for the command and stdout / stderr.
Attributes
Public Class Methods
Source
# File lib/rvm/shell/result.rb, line 11 def initialize(command, status, stdout, stderr) @command = command.dup.freeze @raw_status = status @environment = (@raw_status ? (@raw_status["environment"] || {}) : {}) @successful = (exit_status == 0) @stdout = stdout.freeze @stderr = stderr.freeze end
Creates a new result object with the given details.
Public Instance Methods
Source
# File lib/rvm/shell/result.rb, line 31 def [](key) env[key.to_s] end
Returns a value from the outputs environment.
Source
# File lib/rvm/shell/result.rb, line 21 def env @environment end
Returns the hash of the environment.
Source
# File lib/rvm/shell/result.rb, line 36 def exit_status @exit_status ||= (Integer(@raw_status["exit_status"]) rescue 1) end
Returns the exit status for the program
Source
# File lib/rvm/shell/result.rb, line 26 def successful? @successful end
Whether or not the command had a successful exit status.