only trap signals in front end scripts

Otherwise children execute kill egain and the shell segfaults

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-06-08 21:23:53 +02:00
parent 56cf428d4c
commit 6f99de75a5
3 changed files with 8 additions and 3 deletions

View file

@ -355,6 +355,8 @@ __cdist_tmp_removal()
rm -rf "${__cdist_tmp_dir}"
}
# Does not work in children, will be called again in every script!
# Use only in interactive "front end" scripts
__cdist_kill_on_interrupt()
{
__cdist_tmp_removal
@ -364,9 +366,6 @@ __cdist_kill_on_interrupt()
# Remove tempfiles at normal exit
trap __cdist_tmp_removal EXIT
# Kill children on interrupt
trap __cdist_kill_on_interrupt INT TERM
################################################################################
# Type

View file

@ -25,6 +25,9 @@
[ $# -eq 1 ] || __cdist_usage "<target host>"
set -eu
# Kill children on interrupt - only in interactive scripts
trap __cdist_kill_on_interrupt INT TERM
__cdist_target_host="$1"
# Make target host available for non-core

View file

@ -25,6 +25,9 @@
[ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]"
set -u
# Kill children on interrupt - only in interactive scripts
trap __cdist_kill_on_interrupt INT TERM
filter()
{
awk -v host=$1 '{ print "[" host "] " $0 }'