From 89a1b639d50e8c678e32c1e66c83a1c3ec8624aa Mon Sep 17 00:00:00 2001 From: louiehummv <75245863+louiehummv@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:02:43 -0500 Subject: [PATCH 1/2] Update multi_switch.sh resolves failure when PID doesn't exist --- multi_switch.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/multi_switch.sh b/multi_switch.sh index 3a9db69..9287289 100644 --- a/multi_switch.sh +++ b/multi_switch.sh @@ -60,8 +60,11 @@ function wait_forpid() { # This function needs a valid pidarray function close_emulators() { for ((z=${#pidarray[*]}-1; z>-1; z--)); do - kill ${pidarray[z]} - wait_forpid ${pidarray[z]} + if ps -p ${pidarray[z]} > /dev/null + then + kill ${pidarray[z]} + wait_forpid ${pidarray[z]} + fi done unset pidarray } From 58ceaa2b8632e6a3b599a9e81c9f6c2cf953c8f2 Mon Sep 17 00:00:00 2001 From: louiehummv <75245863+louiehummv@users.noreply.github.com> Date: Mon, 30 Nov 2020 04:06:26 -0500 Subject: [PATCH 2/2] Update multi_switch.sh --- multi_switch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multi_switch.sh b/multi_switch.sh index 9287289..d756034 100644 --- a/multi_switch.sh +++ b/multi_switch.sh @@ -64,7 +64,7 @@ function close_emulators() { then kill ${pidarray[z]} wait_forpid ${pidarray[z]} - fi + fi done unset pidarray }