Class: Train::Transports::Local::Connection::WindowsPipeRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/local.rb

Instance Method Summary collapse

Constructor Details

#initializeWindowsPipeRunner

Returns a new instance of WindowsPipeRunner.



135
136
137
138
# File 'lib/train/transports/local.rb', line 135

def initialize
  @pipe = acquire_pipe
  fail PipeError if @pipe.nil?
end

Instance Method Details

#run_command(cmd) ⇒ Object



140
141
142
143
144
145
146
147
# File 'lib/train/transports/local.rb', line 140

def run_command(cmd)
  script = "$ProgressPreference='SilentlyContinue';" + cmd
  encoded_script = Base64.strict_encode64(script)
  @pipe.puts(encoded_script)
  @pipe.flush
  res = OpenStruct.new(JSON.parse(Base64.decode64(@pipe.readline)))
  Local::CommandResult.new(res.stdout, res.stderr, res.exitstatus)
end