Class: Mixlib::ShellOut::Helper::FakeShellOut
- Inherits:
-
Object
- Object
- Mixlib::ShellOut::Helper::FakeShellOut
- Defined in:
- lib/mixlib/shellout/helper.rb
Instance Attribute Summary collapse
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #error! ⇒ Object
- #error? ⇒ Boolean
-
#initialize(args, options, result) ⇒ FakeShellOut
constructor
A new instance of FakeShellOut.
Constructor Details
#initialize(args, options, result) ⇒ FakeShellOut
Returns a new instance of FakeShellOut.
208 209 210 211 212 213 214 215 216 |
# File 'lib/mixlib/shellout/helper.rb', line 208 def initialize(args, , result) @args = args @options = @stdout = result.stdout @stderr = result.stderr @exitstatus = result.exit_status @valid_exit_codes = Array([:returns] || 0) @status = OpenStruct.new(success?: (@valid_exit_codes.include? exitstatus)) end |
Instance Attribute Details
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
206 207 208 |
# File 'lib/mixlib/shellout/helper.rb', line 206 def exitstatus @exitstatus end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
206 207 208 |
# File 'lib/mixlib/shellout/helper.rb', line 206 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
206 207 208 |
# File 'lib/mixlib/shellout/helper.rb', line 206 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
206 207 208 |
# File 'lib/mixlib/shellout/helper.rb', line 206 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
222 223 224 |
# File 'lib/mixlib/shellout/helper.rb', line 222 def error! raise Mixlib::ShellOut::ShellCommandFailed, "Unexpected exit status of #{exitstatus} running #{@args}: #{stderr}" if error? end |
#error? ⇒ Boolean
218 219 220 |
# File 'lib/mixlib/shellout/helper.rb', line 218 def error? @valid_exit_codes.none?(exitstatus) end |