Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/net/winrm/receive_response_reader.rb
Views: 11778
require 'winrm'12module Net3module MsfWinRM4# For parsing of output streams (stdout, stderr); subclassed5# so MSF can manage retry loops itself6class ReceiveResponseReader < WinRM::WSMV::ReceiveResponseReader7def send_get_output_message(message)8# Overridden without retry loop9@transport.send_request(message)10end1112# Reads streams sent in one or more receive response messages13# @param wsmv_message [WinRM::WSMV::Base] A wsmv message to send to endpoint14# @param wait_for_done_state whether to poll for a CommandState of Done15# @yieldparam [Hash] Hash representation of stream with type and text16# @yieldparam [REXML::Document] Complete SOAP envelope returned to wsmv_message17# rubocop:disable Style/OptionalBooleanParameter - want to keep same signature as base class18def read_response(wsmv_message, wait_for_done_state = false)19# rubocop:enable Style/OptionalBooleanParameter20resp_doc = nil21until command_done?(resp_doc, wait_for_done_state)22logger.debug('[WinRM] Waiting for output...')23resp_doc = send_get_output_message(wsmv_message.build)24logger.debug('[WinRM] Processing output')25read_streams(resp_doc) do |stream|26yield stream, resp_doc27end28end2930if command_done?(resp_doc, true)31raise EOFError, 'Program terminated'32end33end34end35end36end373839