Class | RVM::Shell::Result |
In: |
lib/rvm/shell/result.rb
|
Parent: | Object |
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.
command | [R] | |
raw_status | [R] | |
stderr | [R] | |
stdout | [R] |
Creates a new result object with the given details.
# File lib/rvm/shell/result.rb, line 11 def initialize(command, status, stdout, stderr) @command = command.dup.freeze @raw_status = status @environment = @raw_status["environment"] || {} @successful = (exit_status == 0) @stdout = stdout.freeze @stderr = stderr.freeze end
Returns a value from the outputs environment.
# File lib/rvm/shell/result.rb, line 31 def [](key) env[key.to_s] end
Returns the hash of the environment.
# File lib/rvm/shell/result.rb, line 21 def env @environment end
Returns the exit status for the program
# File lib/rvm/shell/result.rb, line 36 def exit_status @exit_status ||= (Integer(@raw_status["exit_status"]) rescue 1) end