Skip to content

Commit 4f1f649

Browse files
committed
(gh-13) Fail for curl 404
By default, curl captures as the -o file whatever the server response is for <500 responses (excepting -L redirects), which means that a 404 file not found error doesn't bubble up from the task until we later try to do something with the file, like asking rpm or dpkg to install the server's html 404 response text... Adding --fail-with-body still captures the response but returns non-zero and let's us halt at the download() where we want.
1 parent a2f58a2 commit 4f1f649

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

files/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ download() {
143143
if exists 'wget'; then
144144
exec_and_capture wget -O "${_file}" "${_url}"
145145
elif exists 'curl'; then
146-
exec_and_capture curl -sSL -o "${_file}" "${_url}"
146+
exec_and_capture curl --fail-with-body -sSL -o "${_file}" "${_url}"
147147
else
148148
fail "Unable to download ${_url}. Neither wget nor curl are installed."
149149
fi

0 commit comments

Comments
 (0)