Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

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

Closed mnaamani closed 11 months ago

mnaamani commented 11 months ago

Depends on https://github.com/Joystream/joystream/pull/4913 and https://github.com/Joystream/joystream/pull/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