Added unhappy_ending to happy wrappy

Now happy prints the command line that failed before exiting!
This commit is contained in:
Andrew Rogers 2023-05-04 14:38:30 -05:00
commit 64066d0172

View file

@ -1,2 +1,7 @@
# Don't want subsequent commands to run after nonzero exit? Wrappy in happy! # Don't want subsequent commands to run after nonzero exit? Wrappy in happy!
happy() { $@ || exit $?; } unhappy_ending() {
stat=$1; shift
(echo "Error while running: \"$@\"" >&2)
exit $stat
}
happy() { $@ || unhappy_ending $? $@; }