Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash scripts: proper error handling when invoking sub shell scripts #4917

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

mnaamani
Copy link
Member

@mnaamani mnaamani commented Oct 9, 2023

Depends on #4913 and #4935

General fix to all shell scripts to correctly exit script when calling a sub script fails.

TLDR:
we have set -e in scripts that needs to exit when a subscript fails.

Using this:

output=$( expression )

captures output but doesn't cause calling script to exit with error. (You have to manually check exit code with $?)

output=`expression`

Works better because it captures output and a non zero exit code from the expression/script with make the calling script exit correctly with an error code.

┆Issue is synchronized with this Asana task by Unito

@mnaamani mnaamani requested a review from zeeshanakram3 October 9, 2023 08:07
@mnaamani mnaamani marked this pull request as ready for review October 16, 2023 08:26
@mnaamani mnaamani requested a review from ignazio-bovo October 16, 2023 11:10
Copy link
Contributor

@ignazio-bovo ignazio-bovo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mnaamani mnaamani merged commit fb5f268 into Joystream:nara Oct 23, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants