mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-19 19:15:14 +00:00
fix invalid kill with multiple pids
This commit is contained in:
parent
20c1097281
commit
a5807344d5
11
src/tomb
11
src/tomb
@ -760,14 +760,21 @@ exec_safe_post_hooks() {
|
|||||||
kill_tomb() {
|
kill_tomb() {
|
||||||
# $1 = pids to kill
|
# $1 = pids to kill
|
||||||
# $2 = type of 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..."
|
func "killing PID $p..."
|
||||||
if [[ "$2" == "soft" ]]; then
|
if [[ "$2" == "soft" ]]; then
|
||||||
kill -USR1 $p
|
kill -USR1 $p
|
||||||
elif [[ "$2" == "hard" ]]; then
|
elif [[ "$2" == "hard" ]]; then
|
||||||
kill -TERM $p
|
kill -TERM $p
|
||||||
elif [[ "$2" == "must die" ]]; then
|
elif [[ "$2" == "must die" ]]; then
|
||||||
kill -9 $p
|
kill -KILL $p
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user