lib/vagrant-windows/communication/winrmshell.rb in vagrant-windows-1.6.0.pre.1 vs lib/vagrant-windows/communication/winrmshell.rb in vagrant-windows-1.6.0
- old
+ new
@@ -75,9 +75,17 @@
$new_file = [System.IO.Path]::GetFullPath(\"#{to}\")
[System.IO.File]::WriteAllBytes($new_file,$bytes)
EOH
end
+ def download(from, to)
+ @logger.debug("Downloading: #{from} to #{to}")
+ output = powershell("[System.convert]::ToBase64String([System.IO.File]::ReadAllBytes(\"#{from}\"))")
+ contents = output[:data].map!{|line| line[:stdout]}.join.gsub("\\n\\r", '')
+ out = Base64.decode64(contents)
+ IO.binwrite(to, out)
+ end
+
protected
def execute_shell(command, shell=:powershell, &block)
raise Errors::WinRMInvalidShell, :shell => shell unless shell == :cmd || shell == :powershell
begin