Skip to content

Commit 4859079

Browse files
committed
Clean up fetch_url
1 parent aa651b7 commit 4859079

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

bin/ruby-build

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,16 @@ make_package() {
8989
popd >&4
9090
}
9191

92-
if type curl &>/dev/null; then
93-
fetch_url() { curl "$@" ;}
94-
elif type wget &>/dev/null; then
95-
fetch_url() { wget -O- "$@" ;}
96-
else
97-
fetch_url() { echo "curl or wget is required" >&2; exit 1 ;}
98-
fi
92+
fetch_url() {
93+
if type curl 2>/dev/null; then
94+
curl "$@"
95+
elif type wget 2>/dev/null; then
96+
wget -O- "$@"
97+
else
98+
echo "error: please install \`curl\` or \`wget\` and try again" >&2
99+
exit 1
100+
fi
101+
}
99102

100103
fetch_tarball() {
101104
local package_name="$1"

0 commit comments

Comments
 (0)