From 3bf61fcda1f651db4e0973c5c01af9321c217c81 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 19 Jun 2024 00:51:52 -0700 Subject: [PATCH] fixed battle net from exiting script --- NonSteamLaunchers.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index c15b0c0..f3d9e96 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -1154,14 +1154,15 @@ if [[ $options == *"Battle.net"* ]]; then max_attempts=20 attempt=0 while true; do - if pgrep -f "Battle.net.exe" || pgrep -f "BlizzardError.exe" > /dev/null; then + if pgrep -f "Battle.net.exe" > /dev/null || pgrep -f "BlizzardError.exe" > /dev/null; then pkill -f "Battle.net.exe" || pkill -f "BlizzardError.exe" - break - fi - sleep 1 - ((attempt++)) - if [ "$attempt" -ge "$max_attempts" ]; then - echo "Timeout: Battle.net process did not terminate." + sleep 5 + ((attempt++)) + if [ "$attempt" -ge "$max_attempts" ]; then + echo "Timeout: Battle.net process did not terminate." + break + fi + else break fi done