diff options
author | tv <tv@also> | 2010-04-26 16:33:52 +0200 |
---|---|---|
committer | tv <tv@also> | 2010-04-26 16:33:52 +0200 |
commit | db8d3910efdaf735fa51f012fb48b52e23f25c4c (patch) | |
tree | e7132af11e42cbd0cfb50149f0677761155e231e | |
parent | 50aa02ccf1de40bc5f518d212a89c587c2b7d859 (diff) |
Reap child processes on EXIT
-rwxr-xr-x | noise | 34 |
1 files changed, 8 insertions, 26 deletions
@@ -6,7 +6,7 @@ noise_set() { # set a variable s/^noise_([[:alnum:]_]+)=(.*)$/[35;4m\1[;35m = [32m\2[m/p ' | sort elif test "x$2" = x ; then - eval "echo \"[35;4m$1[0;35m is [0;32m\$noise_$1[m\"" + eval "echo \"[35;4m$1[0;35m = [0;32m\$noise_$1[m\"" else if echo "$1" | grep -q '[^[:alnum:]_]' ; then fail invalid variable name "[4m$1" @@ -35,8 +35,13 @@ fail() { return 23 } +cleanup() { + rm -f $linefeed + kill $jobs +} + linefeed="/tmp/noise-client-$$" -trap "rm -f $linefeed" EXIT +trap cleanup EXIT mkfifo $linefeed while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn " s:^/([a-z]+)([[:space:]]+(.*))?$:command='\1'; args='\3';:p;t @@ -60,6 +65,7 @@ while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn " ## fail unknown command "[4m$command[m" done <$linefeed & +jobs="${jobs+$jobs }`jobs -p`" cat<<EOF [35mwelcome to [4mSHACK UTTERANCE[;35m version 0.9 beta 2 get help with [32m/help[m @@ -76,27 +82,3 @@ $REPLY EOF done #### end of file. - - - - -exit -modcall() { - for dir in `echo "$NOISE_PATH" | tr : \ ` ; do - module="$dir/$1" - if test -x "$module" ; then - shift - "$module" "$@" - : && return - fi - done - return 23 -} - -funcall() { - if type noise_"$1" &>/dev/null ; then - noise_"$@" - : && return - fi - return 23 -} |