Skip to content

Commit ea8a9cb

Browse files
committed
fix: log and exit on curl download errors
- Add error handling for failed curl downloads by logging an error and exiting with code 6 Signed-off-by: appleboy <appleboy.tw@gmail.com>
1 parent 7d4d14f commit ea8a9cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function download_and_install() {
5555
# Use temp dir for download
5656
TARGET="${TMPDIR}/${CLIENT_BINARY}"
5757

58-
curl -# -fSL --retry 5 --keepalive-time 2 ${INSECURE_ARG} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
58+
curl -# -fSL --retry 5 --keepalive-time 2 ${INSECURE_ARG} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}" || log_error "Failed to download ${CLIENT_BINARY}" 6
5959
chmod +x "${TARGET}" || log_error "Failed to set executable permission on: ${TARGET}" 7
6060
# Move the binary to install dir and rename to gorush
6161
mv "${TARGET}" "${INSTALL_DIR}/gorush" || log_error "Failed to move ${TARGET} to ${INSTALL_DIR}/gorush" 8

0 commit comments

Comments
 (0)