GEOMESA-3561 install-dependencies.sh script should exit with non-zero status if a download fails#3516
Open
cptlobster wants to merge 1 commit intolocationtech:mainfrom
Open
Conversation
5c009ac to
e15c00e
Compare
Contributor
|
the exit code seems fixed, but now it always prints out |
elahrvivaz
reviewed
Feb 27, 2026
| tmpfile=$(mktemp) | ||
| # -sS disables progress meter but keeps error messages, -f don't save failed files, -o write to destination file, -L follow redirects | ||
| downloads+=("(echo >&2 fetching $fname && curl -LsSfo '$tmpfile' '$url' && mv '$tmpfile' '${dest}/${fname}' && chmod 644 '${dest}/${fname}') || echo [ERROR] Failed to fetch $fname") | ||
| downloads+=("(echo >&2 fetching $fname && curl -LsSfo '$tmpfile' '$url' && mv '$tmpfile' '${dest}/${fname}' && chmod 644 '${dest}/${fname}') || export error=\$?; echo [ERROR] Failed to fetch $fname; exit \$error") |
Contributor
There was a problem hiding this comment.
Suggested change
| downloads+=("(echo >&2 fetching $fname && curl -LsSfo '$tmpfile' '$url' && mv '$tmpfile' '${dest}/${fname}' && chmod 644 '${dest}/${fname}') || export error=\$?; echo [ERROR] Failed to fetch $fname; exit \$error") | |
| downloads+=("(echo >&2 fetching $fname && curl -LsSfo '$tmpfile' '$url' && mv '$tmpfile' '${dest}/${fname}' && chmod 644 '${dest}/${fname}') || (export error=\$?; echo [ERROR] Failed to fetch $fname; exit \$error)") |
() seems to fix it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the
functions.shhelper:If the subshell running
curland the associated commands fails, it runs the followingechocommand. This changes the exit code outputted by the subshell to 0, and as such all commands sent toxargswill return 0. Therefore, any failures in this process will be silently ignored, and theinstall-dependencies.shscript (and others) will exit as if they succeeded.This PR saves the exit code from the subshell to a variable and then exits with that code after sending the echo.
xargswill then properly exit with code 123 if any of the downloads fail.