From f5a172debfdbd5171b1bd2cf7a10e6afc88aa08f Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 14 Nov 2022 12:22:06 +0100 Subject: [PATCH] macOS: Fix restart-after-quit Instead of using a dictionary for the value of KeepAlive, setting it to @NO will keep launchd from relaunching the client. Signed-off-by: Camila Ayres --- src/common/utility_mac.mm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/utility_mac.mm b/src/common/utility_mac.mm index 6290de3b94eed..f604e9a2924c7 100644 --- a/src/common/utility_mac.mm +++ b/src/common/utility_mac.mm @@ -79,6 +79,7 @@ } // Now write the file. + qCInfo(lcUtility()) << "Writing plist file" << QString::fromNSString(plistFile); // Especially for branded clients: log the file name, so it can be found when debugging. if (![plist writeToURL:[NSURL fileURLWithPath:plistFile isDirectory:NO] error:&error]) { return QString::fromNSString(error.localizedDescription); } @@ -143,10 +144,7 @@ { NSDictionary *plistTemplate = @{ @"Label" : QCoreApplication::organizationDomain().toNSString(), - @"KeepAlive" : @ { - @"Crashed" : @NO, - @"SuccessfulExit" : @NO - }, + @"KeepAlive" : @NO, @"Program" : fullPath, @"RunAtLoad" : enable ? @YES : @NO }; @@ -208,7 +206,7 @@ if (!result) { qCWarning(lcUtility) << result.error(); } - } else if ([fullPath compare:programValue options:NSCaseInsensitiveSearch] == NSOrderedSame) { // (Note: case insensitive compare, because most fs setups on mac are case insensitive) + } else if ([fullPath compare:programValue options:NSCaseInsensitiveSearch] == NSOrderedSame) { // (Note: case insensitive compare, because most fs setups on mac are lse if (![fileManager fileExistscase insensitive) // Wohoo, it's ours! Now carefully change only the RunAtLoad entry. If any value for // e.g. KeepAlive was changed, we leave it as-is. auto result = modifyPlist(plistFile, plist, enable);