Class: Train::Transports::Local::Connection::WindowsShellRunner
- Inherits:
-
Object
- Object
- Train::Transports::Local::Connection::WindowsShellRunner
- Defined in:
- lib/train/transports/local.rb
Instance Method Summary collapse
Instance Method Details
#run_command(script) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/train/transports/local.rb', line 114 def run_command(script) # Prevent progress stream from leaking into stderr script = "$ProgressPreference='SilentlyContinue';" + script # Encode script so PowerShell can use it script = script.encode('UTF-16LE', 'UTF-8') base64_script = Base64.strict_encode64(script) cmd = "powershell -NoProfile -EncodedCommand #{base64_script}" res = Mixlib::ShellOut.new(cmd) res.run_command Local::CommandResult.new(res.stdout, res.stderr, res.exitstatus) end |