[Bootstrap] Add multi-instance handling
This commit is contained in:
parent
562340a9c5
commit
9674d9e483
2 changed files with 11 additions and 0 deletions
10
src/bootstrap.js
vendored
10
src/bootstrap.js
vendored
|
@ -68,6 +68,8 @@ const startUpdate = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const hasArgvFlag = (flag) => (process.argv || []).slice(1).includes(flag);
|
||||
|
||||
module.exports = () => {
|
||||
// Paths logging
|
||||
log('Paths', `Init! Returns:
|
||||
|
@ -77,6 +79,14 @@ getResources: ${paths.getResources()}
|
|||
getModuleDataPath: ${paths.getModuleDataPath()}
|
||||
getInstallPath: ${paths.getInstallPath()}`);
|
||||
|
||||
const instanceLock = app.requestSingleInstanceLock();
|
||||
const allowMultiInstance = hasArgvFlag('--multi-instance') || oaConfig.multiInstance; // argv flag or config
|
||||
|
||||
if (!instanceLock && !allowMultiInstance) {
|
||||
log('Bootstrap', 'Non-first instance, quitting (multi-instance disabled)');
|
||||
return app.quit();
|
||||
}
|
||||
|
||||
if (app.isReady()) {
|
||||
startUpdate();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue