From 0f519a97674202fc430d267540e9ea5f3a945383 Mon Sep 17 00:00:00 2001 From: Cameron Lowell Palmer Date: Tue, 10 Aug 2021 16:10:54 +0200 Subject: [PATCH] Fix wireguard to detect launchd on Monterey --- src/wg-quick/darwin.bash | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash index c77441fa..1d56b1a5 100755 --- a/src/wg-quick/darwin.bash +++ b/src/wg-quick/darwin.bash @@ -85,13 +85,13 @@ parse_options() { } detect_launchd() { - unset LAUNCHED_BY_LAUNCHD - local line - while read -r line; do - if [[ $line =~ ^\s*domain\ =\ ]]; then - LAUNCHED_BY_LAUNCHD=1 - break - fi + LAUNCHED_BY_LAUNCHD=1 + local line + while read -r line; do + if [[ $line =~ ^\s*\(pid\ $$\ is\ not\ managed\ by\ launchd\) ]]; then + unset LAUNCHED_BY_LAUNCHD + break + fi done < <(launchctl procinfo $$ 2>/dev/null) }