shlib.sh: refactor bang into bang plus bang_catch
commit7009f8677d8e3de5959075080ad2e1fab100c484
authorKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 17:34:50 +0000 (8 09:34 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 17:34:50 +0000 (8 09:34 -0800)
tree21b739edec867399872af3b4adcd61e9b5b546b9
parente9ac6eae9ddb0cc33a93f3b15a09e3536efb1d55
shlib.sh: refactor bang into bang plus bang_catch

Put the bulk of the "bang()" function into a new "bang_catch()"
function that does everything including setting bang_errcode to the
result but does not actually call bang_failed on non-zero result
codes.

Put the test for a non-zero result code into the "bang()" function
itself thereby allowing clients to choose to use the "bang_catch()"
function instead in order to reap all the benefits of "bang" logging
etc. while still being able to trap a non-zero result code.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
shlib.sh