2020-03-20 13:28:31 -07:00
|
|
|
const { app } = require('electron');
|
2017-09-20 11:58:10 +09:00
|
|
|
|
2020-02-03 16:43:22 -06:00
|
|
|
app.whenReady().then(() => {
|
2020-03-20 13:28:31 -07:00
|
|
|
console.log('started'); // ping parent
|
|
|
|
});
|
2017-09-20 11:58:10 +09:00
|
|
|
|
2020-03-20 13:28:31 -07:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock();
|
2018-05-08 01:29:18 +10:00
|
|
|
|
2021-10-14 18:32:32 -07:00
|
|
|
app.on('second-instance', (event, args, workingDirectory, data) => {
|
2019-03-12 08:56:28 -07:00
|
|
|
setImmediate(() => {
|
2021-10-14 18:32:32 -07:00
|
|
|
console.log([JSON.stringify(args), JSON.stringify(data)].join('||'));
|
2020-03-20 13:28:31 -07:00
|
|
|
app.exit(0);
|
|
|
|
});
|
|
|
|
});
|
2017-09-20 11:58:10 +09:00
|
|
|
|
2018-05-08 01:29:18 +10:00
|
|
|
if (!gotTheLock) {
|
2020-03-20 13:28:31 -07:00
|
|
|
app.exit(1);
|
2017-09-20 11:58:10 +09:00
|
|
|
}
|