launcher: cancel stopping the server when there are unsaved changes in the built-in client

This commit is contained in:
bordun 2021-04-18 12:03:58 +02:00
parent 44f43cb144
commit 54ea332ad6
2 changed files with 17 additions and 4 deletions

View file

@ -7,6 +7,7 @@
- bug fixes
- remote-root option not applied on resources loaded by the client app (css images, etc)
- input: display issue when resizing the window
- launcher: cancel stopping the server when there are unsaved changes in the built-in client
- editor
- context menu: add `export` action to export a widget as a fragment file

View file

@ -144,11 +144,23 @@ function startServerProcess() {
function stopServerProcess() {
if (serverProcess) serverProcess.kill()
for (var w of [...clientWindows]) {
if (w && !w.isDestroyed()) w.close()
if (settings.read('no-gui')) {
if (serverProcess) serverProcess.kill()
return
}
var toClose = [...clientWindows].filter(w=>w && !w.isDestroyed()),
closed = 0
for (var w of toClose) {
w.on('closed', ()=>{
closed++
if (closed === toClose.length) {
clientWindows = []
if (serverProcess) serverProcess.kill()
}
})
w.close()
}
clientWindows = []
}