Skip to content

Commit

Permalink
macOS: Fix restart-after-quit
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
erikjv authored and camilasan committed Jan 10, 2024
1 parent 28b24f9 commit f5a172d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/common/utility_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -143,10 +144,7 @@
{
NSDictionary *plistTemplate = @{
@"Label" : QCoreApplication::organizationDomain().toNSString(),
@"KeepAlive" : @ {
@"Crashed" : @NO,
@"SuccessfulExit" : @NO
},
@"KeepAlive" : @NO,
@"Program" : fullPath,
@"RunAtLoad" : enable ? @YES : @NO
};
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f5a172d

Please sign in to comment.