Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ def download_nightly_hermes(react_native_path, version)
tarball_url = nightly_tarball_url(version)

destination_folder = "#{react_native_path}/sdks/downloads"
destination_path = "#{destination_folder}/hermes-ios.tar.gz"
destination_path = "#{destination_folder}/hermes-ios-#{version}.tar.gz"

`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{destination_path}"`
unless File.exist?(destination_path)
# Download to a temporary file first so we don't cache incomplete downloads.
tmp_file = "#{destination_folder}/hermes-ios.download"
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I know it is the same thing, but this makes more evident that we are moving the file.

Suggested change
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}"`
`mv "#{tmp_file}" "#{destination_path}"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the first command fail, do you know if it would still execute the rename command?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it looks like pod install won't fail and it will continue with the pod installation, with a potentially broken project.

end
return destination_path
end

Expand Down