class WinRM::Output

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

Attributes

exitcode[R]

@return [Integer] exitcode returned from command

Public Class Methods

new() click to toggle source
# File lib/winrm/output.rb, line 18
def initialize
  @data = []
end

Public Instance Methods

<<(data) click to toggle source

Appends stream data to the output

# File lib/winrm/output.rb, line 54
def <<(data)
  @data << data
end
exitcode=(code) click to toggle source

Sets the exitcode

# File lib/winrm/output.rb, line 47
def exitcode=(code)
  raise WinRM::InvalidExitCode unless code.is_a? Integer

  @exitcode = code
end
output() click to toggle source

@return [String] Aggregated stdout and stderr streams

# File lib/winrm/output.rb, line 26
def output
  @data.flat_map do |line|
    [line[:stdout], line[:stderr]]
  end.compact.join
end
stderr() click to toggle source

@return [String] stderr stream output

# File lib/winrm/output.rb, line 40
def stderr
  @data.map do |line|
    line[:stderr]
  end.compact.join
end
stdout() click to toggle source

@return [String] stdout stream output

# File lib/winrm/output.rb, line 33
def stdout
  @data.map do |line|
    line[:stdout]
  end.compact.join
end