Revision 11417
Added by Aaron Marcuse-Kubitza about 11 years ago
lib/runscripts/util.run | ||
---|---|---|
16 | 16 |
"$(dirname "${BASH_SOURCE[1]}")"/path_relative_to_caller |
17 | 17 |
"$top_dir"/path_relative_to_outermost_script |
18 | 18 |
} |
19 |
|
|
20 |
on_exit # needed if should be runnable as shell-include (with leading ".") |
|
19 | 21 |
fi #### |
20 | 22 |
|
21 | 23 |
. "$(dirname "${BASH_SOURCE[0]}")"/../sh/util.sh |
... | ... | |
39 | 41 |
|
40 | 42 |
# users can override run_args_cmd to perform other commands (or no commands) |
41 | 43 |
# after the script is read |
42 |
on_exit() { test $? -eq 0 || return; run_args_cmd; } |
|
44 |
on_exit() { test $? -eq 0 || return; trap - EXIT; run_args_cmd; }
|
|
43 | 45 |
trap on_exit EXIT |
44 | 46 |
|
45 | 47 |
func_override set_paths__util_sh |
Also available in: Unified diff
lib/runscripts/util.run: support scripts that are run as shell-includes (with leading "."), by allowing the calling script to manually invoke on_exit() without it then being invoked twice (the end of a shell-include does not trigger the EXIT trap)