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.
178 179 180 181 182 183 184 185 |
# File 'lib/mixlib/shellout/helper.rb', line 178 def initialize(args, , result) @args = args @options = @stdout = result.stdout @stderr = result.stderr @exitstatus = result.exit_status @status = OpenStruct.new(success?: ( exitstatus == 0 )) end |
Instance Attribute Details
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
176 177 178 |
# File 'lib/mixlib/shellout/helper.rb', line 176 def exitstatus @exitstatus end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
176 177 178 |
# File 'lib/mixlib/shellout/helper.rb', line 176 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
176 177 178 |
# File 'lib/mixlib/shellout/helper.rb', line 176 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
176 177 178 |
# File 'lib/mixlib/shellout/helper.rb', line 176 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
191 192 193 |
# File 'lib/mixlib/shellout/helper.rb', line 191 def error! raise Mixlib::ShellOut::ShellCommandFailed, "Unexpected exit status of #{exitstatus} running #{@args}" if error? end |
#error? ⇒ Boolean
187 188 189 |
# File 'lib/mixlib/shellout/helper.rb', line 187 def error? exitstatus != 0 end |