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 Camila San Martin Ayres committed Jan 14, 2024
1 parent 0a23565 commit c4ee0c2
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 @@ -85,6 +85,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 @@ -149,10 +150,7 @@
{
NSDictionary *plistTemplate = @{
@"Label" : QCoreApplication::organizationDomain().toNSString(),
@"KeepAlive" : @ {
@"Crashed" : @NO,
@"SuccessfulExit" : @NO
},
@"KeepAlive" : @NO,
@"Program" : fullPath,
@"RunAtLoad" : enable ? @YES : @NO
};
Expand Down Expand Up @@ -214,7 +212,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 c4ee0c2

Please sign in to comment.