Check for running daemon
This commit is contained in:
parent
0ad04abce5
commit
bd46bc18cc
1 changed files with 17 additions and 12 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Module imports
|
// Module imports
|
||||||
import keytar from 'keytar-prebuild';
|
import keytar from 'keytar-prebuild';
|
||||||
import SemVer from 'semver';
|
import SemVer from 'semver';
|
||||||
|
import findProcess from 'find-process';
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import { shell, app, ipcMain, dialog } from 'electron';
|
import { shell, app, ipcMain, dialog } from 'electron';
|
||||||
|
@ -57,18 +58,22 @@ app.setAsDefaultProtocolClient('lbry');
|
||||||
app.setName('LBRY');
|
app.setName('LBRY');
|
||||||
|
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
daemon = new Daemon();
|
const processList = await findProcess('name', 'lbrynet-daemon');
|
||||||
daemon.on('exit', () => {
|
const isDaemonRunning = processList.length > 0;
|
||||||
daemon = null;
|
if (!isDaemonRunning) {
|
||||||
if (!isQuitting) {
|
daemon = new Daemon();
|
||||||
dialog.showErrorBox(
|
daemon.on('exit', () => {
|
||||||
'Daemon has Exited',
|
daemon = null;
|
||||||
'The daemon may have encountered an unexpected error, or another daemon instance is already running.'
|
if (!isQuitting) {
|
||||||
);
|
dialog.showErrorBox(
|
||||||
app.quit();
|
'Daemon has Exited',
|
||||||
}
|
'The daemon may have encountered an unexpected error, or another daemon instance is already running.'
|
||||||
});
|
);
|
||||||
daemon.launch();
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
daemon.launch();
|
||||||
|
}
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
await installExtensions();
|
await installExtensions();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue