Class: WinRM::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/winrm/output.rb

Overview

This class holds raw output and has convenience methods to parse.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOutput

Returns a new instance of Output.



18
19
20
# File 'lib/winrm/output.rb', line 18

def initialize
  @data = []
end

Instance Attribute Details

#exitcodeInteger

Returns exitcode returned from command.

Returns:

  • (Integer)

    exitcode returned from command



23
24
25
# File 'lib/winrm/output.rb', line 23

def exitcode
  @exitcode
end

Instance Method Details

#<<(data) ⇒ Object

Appends stream data to the output



54
55
56
# File 'lib/winrm/output.rb', line 54

def <<(data)
  @data << data
end

#outputString

Returns Aggregated stdout and stderr streams.

Returns:

  • (String)

    Aggregated stdout and stderr streams



26
27
28
29
30
# File 'lib/winrm/output.rb', line 26

def output
  @data.flat_map do |line|
    [line[:stdout], line[:stderr]]
  end.compact.join
end

#stderrString

Returns stderr stream output.

Returns:

  • (String)

    stderr stream output



40
41
42
43
44
# File 'lib/winrm/output.rb', line 40

def stderr
  @data.map do |line|
    line[:stderr]
  end.compact.join
end

#stdoutString

Returns stdout stream output.

Returns:

  • (String)

    stdout stream output



33
34
35
36
37
# File 'lib/winrm/output.rb', line 33

def stdout
  @data.map do |line|
    line[:stdout]
  end.compact.join
end