elogto n'est plus lancé dans un sous-shell

This commit is contained in:
Jephté Clain 2014-08-19 12:32:00 +04:00
parent 5d75e57f54
commit 03797171f8
1 changed files with 14 additions and 6 deletions

View File

@ -391,19 +391,27 @@ elif [ "$action" == "run" ]; then
autoclean "$lockfile"
fi
function __should_fork() {
# tester si la commande doit être lancée dans un sous-shell
local cmd
cmd="${1%% *}"
case "$cmd" in
check_pidfile|remove_pidfile|elogto) return 1;;
esac
return 0
}
function __ctexec() {
local ec=0
if [ -n "$fake" ]; then
echo "$*"
else
edebug "$*"
if [ "${1#check_pidfile }" != "$1" -o "${1#remove_pidfile }" != "$1" ]; then
# cas particulier: les fonctions check_pidfile() et
# remove_pidfile() doivent être exécutée dans le contexte
# courant, et non pas dans un sous-shell
eval "$*"; ec=$?
else
if __should_fork "$1"; then
(eval "$*"); ec=$?
else
# cas particulier: certaines fonctions doivent être exécutée
# dans le contexte courant, et non pas dans un sous-shell
eval "$*"; ec=$?
fi
fi
[ -n "$USCRONTAB_STOPEC" -a "$ec" == "$USCRONTAB_STOPEC" ] && exit 0