immediately shutdown if home server is stopped

This commit is contained in:
Stephen Birarda 2016-01-18 11:31:49 -08:00
parent 21074fe4e4
commit 7186a538b2

View file

@ -87,6 +87,14 @@ function shutdown() {
homeServer.stop();
}
updateTrayMenu(null);
if (homeServer.state == ProcessGroupStates.STOPPED) {
// if the home server is already down, take down the server console now
app.quit();
} else {
// if the home server is still running, wait until we get a state change or timeout
// before quitting the app
var timeoutID = setTimeout(app.quit, 5000);
homeServer.on('state-update', function(processGroup) {
if (processGroup.state == ProcessGroupStates.STOPPED) {
@ -94,8 +102,7 @@ function shutdown() {
app.quit();
}
});
updateTrayMenu(null);
}
}
}
}