From c2b24688ef157c223ba71d2a64541c29aa2ecb3a Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 28 May 2017 21:25:03 +0200 Subject: [PATCH] Another fix in the wall --- dev/ofunctions.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 8af7448..1ea7d18 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -3,7 +3,7 @@ #### OFUNCTIONS MINI SUBSET #### _OFUNCTIONS_VERSION=2.1.4-dev -_OFUNCTIONS_BUILD=2017052802 +_OFUNCTIONS_BUILD=2017052803 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -322,21 +322,21 @@ function KillChilds { return 1 fi - # Warning: pgrep does not exist in cygwin, have this checked in CheckEnvironment - if children="$(pgrep -P "$pid")"; then - if [[ "$pid" == *"$children"* ]]; then - Logger "Bogus pgrep implementation." "CRITICAL" - children="${children/$pid/}" + if kill -0 "$pid" > /dev/null 2>&1; then + # Warning: pgrep does not exist in cygwin, have this checked in CheckEnvironment + if children="$(pgrep -P "$pid")"; then + if [[ "$pid" == *"$children"* ]]; then + Logger "Bogus pgrep implementation." "CRITICAL" + children="${children/$pid/}" + fi + for child in $children; do + Logger "Launching KillChilds \"$child\" true" "DEBUG" #__WITH_PARANOIA_DEBUG + KillChilds "$child" true + done fi - for child in $children; do - Logger "Launching KillChilds \"$child\" true" "DEBUG" #__WITH_PARANOIA_DEBUG - KillChilds "$child" true - done - fi - # Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing - if [ "$self" == true ]; then - if kill -0 "$pid" > /dev/null 2>&1; then + # Try to kill nicely, if not, wait 15 seconds to let Trap actions happen before killing + if [ "$self" == true ]; then kill -s TERM "$pid" Logger "Sent SIGTERM to process [$pid]." "DEBUG" if [ $? != 0 ]; then