Fix process grepping

Excludes the grep process itself
This commit is contained in:
the-sane 2022-11-01 11:50:20 -04:00
parent e1e746cd8f
commit adc627f43c

View File

@ -915,12 +915,12 @@ lutris_restart() {
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then
if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then
# Detect which version of Lutris is running and restart it # Detect which version of Lutris is running and restart it
if [ "$lutris_native" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "/usr/bin/lutris"; then if [ "$lutris_native" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "[/]usr/bin/lutris"; then
# Native Lutris is running # Native Lutris is running
debug_print continue "Restarting native Lutris..." debug_print continue "Restarting native Lutris..."
pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null & pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
fi fi
if [ "$lutris_flatpak" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "/app/bin/lutris"; then if [ "$lutris_flatpak" = "true" ] && pgrep -f lutris | xargs ps -fp | grep -q "[/]app/bin/lutris"; then
# Flatpak Lutris is running # Flatpak Lutris is running
debug_print continue "Restarting flatpak Lutris..." debug_print continue "Restarting flatpak Lutris..."
pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null & pkill -f -SIGTERM lutris && nohup flatpak run net.lutris.Lutris </dev/null &>/dev/null &