From 84e0bc14239c71ff8b889c931e5e45187fda00e9 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Fri, 20 Jan 2023 18:15:49 +0100 Subject: [PATCH] armbian-next: fix, don't try to get pid descendants on non-Linux (fixes Darwin cleanups) --- lib/functions/host/host-utils.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/functions/host/host-utils.sh b/lib/functions/host/host-utils.sh index 5f36841dbe..6a85de2969 100644 --- a/lib/functions/host/host-utils.sh +++ b/lib/functions/host/host-utils.sh @@ -286,11 +286,17 @@ function list_descendants_of_pid() { } function get_descendants_of_pid_array() { + descendants_of_pid_array_result=() # outer scope variable, reset + # if not on Linux, just return; "ps" shenanigans we use are not supported + if [[ "${OSTYPE}" != "linux-gnu" ]]; then + display_alert "get_descendants_of_pid_array: not on Linux, so not supported" "get_descendants_of_pid_array" "debug" + return 0 + fi local descendants descendants="$(list_descendants_of_pid "$1")" display_alert "Descendants of PID $1: ${descendants}" "string - get_descendants_of_pid_array" "debug" # shellcheck disable=SC2206 # lets expand! - descendants_of_pid_array_result=(${descendants}) + descendants_of_pid_array_result=(${descendants}) # outer scope variable display_alert "Descendants of PID $1: ${descendants_of_pid_array_result[*]}" "array = get_descendants_of_pid_array" "debug" }