From 1018c3b2fa12e346bc4e4e6f12b9114959157ab2 Mon Sep 17 00:00:00 2001
From: Alex Smith <alex.smith2844@gmail.com>
Date: Thu, 29 May 2025 01:08:56 +0500
Subject: [PATCH] fix: Take first PID from pgrep for EGS

---
 data_from_portwine/scripts/functions_helper | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index b046d325..92726a39 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -4593,11 +4593,11 @@ portwine_launch () {
         while true ; do
             sleep 5
             if [[ -z "$GAMEPID" ]] ; then
-                GAMEPID="$(pgrep -fa 'EpicPortal|epicusername|epiclocale|AUTH_LOGIN' | awk '{print $1}')"
+                GAMEPID="$(pgrep -fa 'EpicPortal|epicusername|epiclocale|AUTH_LOGIN' | awk '{print $1}' | head -n 1)"
             else
                 if waitpid "$GAMEPID" ; then
                     sleep 1
-                    GAMEPID="$(pgrep -fa 'EpicPortal|epicusername|epiclocale|AUTH_LOGIN' | awk '{print $1}')"
+                    GAMEPID="$(pgrep -fa 'EpicPortal|epicusername|epiclocale|AUTH_LOGIN' | awk '{print $1}' | head -n 1)"
                     [[ -z "$GAMEPID" ]] && break || continue
                 fi
             fi