From a5807344d5a18de9c038d5a778b865dbeb133808 Mon Sep 17 00:00:00 2001 From: Anathema Date: Thu, 18 Aug 2011 00:16:00 +0200 Subject: [PATCH] fix invalid kill with multiple pids --- src/tomb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tomb b/src/tomb index e8ff1f3..dde2611 100755 --- a/src/tomb +++ b/src/tomb @@ -760,14 +760,21 @@ exec_safe_post_hooks() { kill_tomb() { # $1 = pids to kill # $2 = type of kill - for p in "$1"; do + local e p + # substitute the \n with space + e=${1//$'\n'/ } + # split the string at space delim + # so we can get a for loop honestly + e=(${(s: :)e}) + for p in $e; do + echo "p $p" func "killing PID $p..." if [[ "$2" == "soft" ]]; then kill -USR1 $p elif [[ "$2" == "hard" ]]; then kill -TERM $p elif [[ "$2" == "must die" ]]; then - kill -9 $p + kill -KILL $p fi done }