[pacman-dev] [patch] makepkg3 -- cleanup dep check functions
Aaron Griffin
aaronmgriffin at gmail.com
Fri Jun 1 14:46:55 EDT 2007
On 6/1/07, Andrew Fyfe <andrew at neptune-one.net> wrote:
> >> - replace the exit calls with a call to a clean up function eg
> >> die() {
> >> local EXIT_CODE=$1; shift
> >> if [ $EXIT_CODE -gt 0 ]; then
> >> error "$@"
> >> fi
> >>
> >> if [ RMDEPS && DEPS_INSTALLED ]; then
> >> remove_deps
> >> fi
> >>
> >> ...
> >>
> >> exit $EXIT_CODE
> >> }
> > Probably not a bad idea, although let's get some other opinions. die
> > is an awfully harsh name, perhaps just cleanup. :P
> But cleanup doesn't sound as eViL as die :p. I prefer something like
> do_exit, cleanup is a little misleading people reading the code need to
> know the script will exit after {die,cleanup,do_exit}.
This is probably a good case for bash traps... you can set a bunch of
traps on things like keyboard interrupt, termination, etc and call the
cleanup function then.
Try "help trap" at a bash prompt
More information about the pacman-dev
mailing list