lib/vagrant/util/downloader.rb in vagrant-unbundled-2.0.4.0 vs lib/vagrant/util/downloader.rb in vagrant-unbundled-2.1.1.0

- old
+ new

@@ -290,14 +290,24 @@ # If it didn't exit successfully, we need to parse the data and # show an error message. if result.exit_code != 0 @logger.warn("Downloader exit code: #{result.exit_code}") - parts = result.stderr.split(/\n*curl:\s+\(\d+\)\s*/, 2) - parts[1] ||= "" - raise Errors::DownloaderError, - code: result.exit_code, - message: parts[1].chomp + check = result.stderr.match(/\n*curl:\s+\((?<code>\d+)\)\s*(?<error>.*)$/) + if check && check[:code] == "416" + # All good actually. 416 means there is no more bytes to download + @logger.warn("Downloader got a 416, but is likely fine. Continuing on...") + else + if !check + err_msg = result.stderr + else + err_msg = check[:error] + end + + raise Errors::DownloaderError, + code: result.exit_code, + message: err_msg + end end result end