Commit e24cef89 authored by Eric Coissac's avatar Eric Coissac

manage a stack of command to run at the exit of the script

parent 2f764996
# LECA Bash library
#
# The LECA bash library provides a set of function used for helping
# development of bash script mainly to write job script on the luke
# cluster
#
# The files from the LECA Bash library must be sourced from your main script
#
#
include logging
logdebug "Load atexit package"
include stacks
newstack __LECABASHLIB_ATEXITSTACK__
function __atexit__manager__() {
echo coucou
while popvalue __LECABASHLIB_ATEXITSTACK__ cmd ; do
eval "$cmd"
done
}
function registeratexit() {
pushvalue __LECABASHLIB_ATEXITSTACK__ "${1}"
}
trap "__atexit__manager__" EXIT ERR
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment