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.



20
21
22
# File 'lib/winrm/output.rb', line 20

def initialize
  @data = []
end

Instance Attribute Details

#exitcodeInteger

Returns exitcode returned from command.

Returns:

  • (Integer)

    exitcode returned from command



25
26
27
# File 'lib/winrm/output.rb', line 25

def exitcode
  @exitcode
end

Instance Method Details

#<<(data) ⇒ Object

Appends stream data to the output



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

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

#outputString

Returns Aggregated stdout and stderr streams.

Returns:

  • (String)

    Aggregated stdout and stderr streams



28
29
30
31
32
# File 'lib/winrm/output.rb', line 28

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



42
43
44
45
46
# File 'lib/winrm/output.rb', line 42

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

#stdoutString

Returns stdout stream output.

Returns:

  • (String)

    stdout stream output



35
36
37
38
39
# File 'lib/winrm/output.rb', line 35

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