Skip to content

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

Merged
mnaamani merged 3 commits into
Joystream:narafrom
mnaamani:nara-shell-scripts-refactor
Oct 23, 2023
Merged

mnaamani merged 3 commits into
Joystream:narafrom
mnaamani:nara-shell-scripts-refactor

Conversation

@mnaamani

@mnaamani mnaamani commented Oct 9, 2023 •

Copy link
Copy Markdown
Member

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

@dobertRowneySr dobertRowneySr left a comment

Copy link
Copy Markdown
Collaborator

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
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