Skip to content

Commit 21b63e6

Browse files
authored
Fix open-uri call (#319)
Without this fix downloading will fail like: Host OS... linux Attempting to download Arduino 0.13.0 package with open-uribundler: failed to load command: arduino_ci.rb (/.../vendor/bundle/ruby/3.0.0/bin/arduino_ci.rb) /.../arduino_ci/lib/arduino_ci/arduino_downloader.rb:111:in `initialize': No such file or directory @ rb_sysopen - https://github.com/arduino/arduino-cli/releases/download/0.13.0/arduino-cli_0.13.0_Linux_64bit.tar.gz (Errno::ENOENT) and when running through trace the log gives: access("/usr/bin/tar", X_OK) = 0 newfstatat(AT_FDCWD, "/usr/bin/tar", {st_mode=S_IFREG|0755, st_size=527464, ...}, 0) = 0 newfstatat(AT_FDCWD, "arduino-cli_0.13.0_Linux_64bit.tar.gz", 0x7fff95f8caa0, 0) = -1 ENOENT (No such file or directory) write(1, "Attempting to download Arduino 0.13.0 package with open-uri", 59) = 59 openat(AT_FDCWD, "https://github.com/arduino/arduino-cli/releases/download/0.13.0/arduino-cli_0.13.0_Linux_64bit.tar.gz", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0 so obviously the bare open call is mapped to a filesystem open call. The gem 'open-uri' is referenced earlier in the file and is obviously the intended target. https://github.com/ruby/open-uri documents the API to be URI.open, and substituting with that made downloading work.
1 parent 3d12bb7 commit 21b63e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/arduino_ci/arduino_downloader.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def download
108108
dots = needed_dots
109109
end
110110

111-
open(package_url, ssl_verify_mode: 0, progress_proc: dot_printer) do |url|
111+
URI.open(package_url, ssl_verify_mode: 0, progress_proc: dot_printer) do |url|
112112
File.open(package_file, 'wb') { |file| file.write(url.read) }
113113
end
114114
rescue Net::OpenTimeout, Net::ReadTimeout, OpenURI::HTTPError, URI::InvalidURIError => e

0 commit comments

Comments
 (0)