fix broken requestSingleInstanceLock in MAS

pull/1401/head
Mikael Finstad 2022-11-23 16:46:04 +08:00
rodzic 0e6f396225
commit 6292f1c7f2
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -149,7 +149,12 @@ function parseCliArgs(rawArgv = process.argv) {
const argv = parseCliArgs();
if (!argv.allowMultipleInstances && !app.requestSingleInstanceLock()) {
function safeRequestSingleInstanceLock() {
if (process.mas) return true; // todo remove when fixed https://github.com/electron/electron/issues/35540
return app.requestSingleInstanceLock();
}
if (!argv.allowMultipleInstances && !safeRequestSingleInstanceLock()) {
app.quit();
} else {
// On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.