Commit 0237658f by Eric Coissac

Patch the signal run function to no more rely on wait

parent 35e2fc46
...@@ -57,7 +57,7 @@ __LECABASH__trap_function__() { ...@@ -57,7 +57,7 @@ __LECABASH__trap_function__() {
while popvalue "$stackname" cmd ; do while popvalue "$stackname" cmd ; do
logdebug "Running ${signal} command : $cmd" logdebug "Running ${signal} command : $cmd"
eval "$cmd" \ eval "$cmd" \
|| logdebug "Command: '$cmd' generates an error" || logdebug "Command: '$cmd' generates an error"
done done
logdebug "Commands registered on signal $signal run." logdebug "Commands registered on signal $signal run."
fi fi
...@@ -154,7 +154,12 @@ function run() { ...@@ -154,7 +154,12 @@ function run() {
fpid=$! fpid=$!
registertrap ${signal} __LECABASH__kill_running_command__ ${signalto} ${fpid} registertrap ${signal} __LECABASH__kill_running_command__ ${signalto} ${fpid}
killid=$(( $(stacksize "$stackname") - 1 )) killid=$(( $(stacksize "$stackname") - 1 ))
wait
while [ -e /proc/$fpid ]
do
sleep 1
done
logdebug "Remove kill action on $fpid for $signal signal" logdebug "Remove kill action on $fpid for $signal signal"
eval "${stackname}[${killid}]='sleep 0'" eval "${stackname}[${killid}]='sleep 0'"
} }
......
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