This change fixes it.
As explained in the man bash
page:
Shell builtin commands return a status of 0 (true) if successful, and
non-zero (false) if an error
occurs while they execute. All builtins return an exit status of 2 to indicate incorrect usage.
Bash itself returns the exit status of the last command executed,
unless a syntax error occurs, in which case it exits with a non-zero
value. See also the exit builtin command below.
The last command executed is:
[ "$BUILD_CHROMIUM" == 1 ] &&_build_chromium_crx "${zip_file}" "${BUILD_METADATA[${CHROMIUM_TARGET}]}"
And it is evaluated as false
with exit status 1:
'[' 0 == 1 ']'
So adding || true
at the end of this line fixes it. The exit status will always be 0.
Alternatively, use the fix that better suits the expected behavior of your code like exit 0
, etc.
As explained here and here:
exit [n] Cause the shell to exit with a status of n. If n is omitted,
the exit status is that of the last command executed. A trap on EXIT
is executed before the shell terminates.
So your clean function trap _clean_chrome EXIT
is not the last to be executed.
Further information about exit status here.