Skip to content

Commit bbc30ef

Browse files
authored
Merge pull request #131 from kinvolk/fix-server-quiting-on-desktop-app
Desktop: Kill the server running process on app quit
2 parents 7f4f1ac + 2b64034 commit bbc30ef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/electron/main.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,23 @@ autoUpdater.on('update-downloaded', () => {
167167
});
168168

169169
app.on('ready', createWindow);
170-
app.on('window-all-closed', function () {
170+
171+
app.on('quit', function () {
171172
if (serverProcess) {
172173
serverProcess.stdin.pause();
173174
serverProcess.kill();
174-
}
175-
if (process.platform !== 'darwin') {
176-
app.quit();
175+
serverProcess = null;
177176
}
178177
});
178+
179179
app.on('activate', function () {
180180
if (mainWindow === null) {
181181
createWindow();
182182
}
183183
});
184+
185+
app.once('window-all-closed', app.quit);
186+
187+
app.once('before-quit', () => {
188+
mainWindow.removeAllListeners('close');
189+
});

0 commit comments

Comments
 (0)