-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Make bin/dist_get fall back to other downloaders if one fails #3692
Conversation
License: MIT Signed-off-by: Mateusz Naściszewski <[email protected]>
License: MIT Signed-off-by: Mateusz Naściszewski <[email protected]>
bin/dist_get
Outdated
url="$1" | ||
output="$2" | ||
command="$3" | ||
util_name=$(set -- $3; echo $1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets arguments within this shell substitution from $3
, allowing us to get the first word of the command (wget, curl, http) with $1
.
Arguments outside this shell substitution are not clobbered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be reason it fails on circle, or other bashizm. CircleCI uses fsh as sh bin. You probably should change the hashbang to bash or remove the bashizm (preferably the latter)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mateon1! I think this looks good, my only concern is what happens when one tool fails for some network or unrelated error (i.e. the tool works, but something else failed randomly).
Very weird circleCI failure... Worth investigating |
List of issues found by shellcheck, some of the might not be because of this PR.
|
You can try running Bash in a mode closer to POSIX with The bashizm is only my guess why things failed, I am not sure. |
@Kubuxu That is odd, as the |
License: MIT Signed-off-by: Mateusz Naściszewski <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look a bit greener this time. You happy with this one @Kubuxu ?
Also refactored the code a bit, and added httpie.
Note: I used redirection for httpie, as
http -d url -o output
complained its output was redirected.