Project

General

Profile

« Previous | Next » 

Revision 11428

bugfix: lib/runscripts/util.run: `trap on_exit EXIT`: only set this if the script is not a dot script, because if it is a dot script, on_exit() will not be invoked until the calling shell exits, which may be much later than when the script is run. previously, this was handled by canceling the EXIT trap if on_exit() is run manually, but this would not work correctly if a load-time error prevented on_exit() from running and canceling the trap.

View differences:

lib/runscripts/util.run
44 44

  
45 45
# users can override run_args_cmd to perform other commands (or no commands)
46 46
# after the script is read
47
on_exit() { test $? -eq 0 || return; trap - EXIT; run_args_cmd; }
48
trap on_exit EXIT
47
on_exit() { test $? -eq 0 || return; run_args_cmd; }
48
if ! is_dot_script; then trap on_exit EXIT; fi
49 49

  
50 50
func_override set_paths__util_sh
51 51
set_paths()

Also available in: Unified diff