etc: Use _execute for bison download to get log only on failure as for others.#10777
etc: Use _execute for bison download to get log only on failure as for others.#10777titan73 wants to merge 2 commits into
Conversation
…r others. Signed-off-by: Christian Costa <titan.costa@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the Bison download logic in etc/DependencyInstaller.sh by wrapping it in a local function _download_bison and running it via _execute. The review feedback points out that using a subshell wrapper (error ...) to prevent immediate exit is an anti-pattern, suggesting instead to print the error to stderr and return a non-zero exit status to signal failure.
| if [[ ${success} -ne 1 ]]; then | ||
| (error "Could not download bison-${BISON_VERSION}.tar.gz from any mirror.") | ||
| fi |
There was a problem hiding this comment.
Using a subshell wrapper (error ...) to prevent the script from exiting immediately is an anti-pattern and can be confusing. Since _download_bison is executed via _execute (which handles logging and final termination on failure), the function should simply print the error message to stderr and return a non-zero exit status (e.g., return 1) to signal failure to the caller.
| if [[ ${success} -ne 1 ]]; then | |
| (error "Could not download bison-${BISON_VERSION}.tar.gz from any mirror.") | |
| fi | |
| if [[ ${success} -ne 1 ]]; then | |
| echo "Could not download bison-${BISON_VERSION}.tar.gz from any mirror." >&2 | |
| return 1 | |
| fi |
There was a problem hiding this comment.
Fixed. I used "warn ..." instead of an echo though.
As suggested by Gemini. ² Signed-off-by: Christian Costa <titan.costa@gmail.com>
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@precisionmoon Any feedback on this PR? |
On success:
[INFO] Downloading Bison ✔On failure: