2020-03-20 14:28:31 -06:00
|
|
|
const { app } = require('electron');
|
2017-09-19 20:58:10 -06:00
|
|
|
|
2020-02-03 15:43:22 -07:00
|
|
|
app.whenReady().then(() => {
|
2020-03-20 14:28:31 -06:00
|
|
|
console.log('started'); // ping parent
|
|
|
|
});
|
2017-09-19 20:58:10 -06:00
|
|
|
|
2020-03-20 14:28:31 -06:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock();
|
2018-05-07 09:29:18 -06:00
|
|
|
|
2021-11-04 02:14:09 -06:00
|
|
|
app.on('second-instance', (event, args, workingDirectory) => {
|
2019-03-12 09:56:28 -06:00
|
|
|
setImmediate(() => {
|
2023-06-26 03:51:54 -06:00
|
|
|
console.log(JSON.stringify(args), workingDirectory);
|
2020-03-20 14:28:31 -06:00
|
|
|
app.exit(0);
|
|
|
|
});
|
|
|
|
});
|
2017-09-19 20:58:10 -06:00
|
|
|
|
2018-05-07 09:29:18 -06:00
|
|
|
if (!gotTheLock) {
|
2020-03-20 14:28:31 -06:00
|
|
|
app.exit(1);
|
2017-09-19 20:58:10 -06:00
|
|
|
}
|