class Kitchen::Driver::VMMUtils::StreamReader
for powershell stdout read
Public Class Methods
new(&block)
click to toggle source
# File lib/kitchen/driver/vmm_utils.rb, line 57 def initialize(&block) @block = block @buffer = StringIO.new @buffer.sync = true if @buffer.respond_to?(:sync) end
Public Instance Methods
<<(chunk)
click to toggle source
# File lib/kitchen/driver/vmm_utils.rb, line 63 def <<(chunk) overflow = '' @buffer.write(chunk) @buffer.rewind @buffer.each_line do |line| if line.match(/\r?\n/) @block.call(line.strip) else overflow = line end end @buffer.truncate(@buffer.rewind) @buffer.write(overflow) end