Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --retry-download-count for retrying installing Xcode xip/dmg #400

Merged
merged 3 commits into from
Sep 9, 2020

Conversation

freddi-kit
Copy link
Contributor

@freddi-kit freddi-kit commented Sep 7, 2020

Issue

Related: #345

Abstract

Add --retry-download-count for xcversion install command to retry install again

$ xcversion install 11.7  --retry-download-count=5

Motivation

As mentioned #345, some user has an issue to download such big Xcode application. We can re-use this on-the-way result to re-try downloading.

However, retry is limited to 3 times even if the cache is available and it can be used by retrying.

# Line 81 at lib/xcode/install.rb 
3.times do
...

After 3-times, we have to call xcversion again to continue by hand on terminal.

Strategy

So I added --retry-download-count, to retry download automatically. This would help to solve the mentioned issue.

$ xcversion install 11.7  --retry-download-count=5

Note

If invalid arg such kind of -1 and "string", it will be error

$ xcversion install 11.7  --retry-download-count=xcode
[!] Invalid Retry: `xcode is not positive number.`

@freddi-kit freddi-kit changed the title Add --retry-download-count for retrying installing Add --retry-download-count for retrying installing Xcode xip/dmg Sep 7, 2020
Copy link
Collaborator

@jpsim jpsim left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@freddi-kit
Copy link
Contributor Author

Thank you!

@freddi-kit
Copy link
Contributor Author

When is this included to new version?

@jpsim jpsim merged commit 7521678 into xcpretty:master Sep 9, 2020
@jpsim
Copy link
Collaborator

jpsim commented Sep 9, 2020

I don't know, I don't have access to push new versions to rubygems.

@freddi-kit freddi-kit deleted the feature/retry-count-option branch September 10, 2020 04:13
@freddi-kit
Copy link
Contributor Author

freddi-kit commented Sep 10, 2020

okay, I wish it will be delivered soon. thank you for merging it

@pronebird
Copy link

pronebird commented Oct 15, 2020

Would it make sense to not count errors when the curl reports that more data is left to read? For example:

curl: (18) transfer closed with 9327120816 bytes remaining to read

There is obviously 9327120816 bytes more to read, so can this be taken into account somehow? It makes total sense to continue the download instead of failing.

@freddi-kit
Copy link
Contributor Author

I think it would be better, but I think we need some string parser to get byte from the error message. And not sure the error message is stable or not on each curl version.

@pronebird
Copy link

@freddi-kit aha so there is no back channel from curl, like exit code or something?

@freddi-kit
Copy link
Contributor Author

freddi-kit commented Oct 16, 2020

@pronebird Ah, maybe we can use exit code, let me check it after #405 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants