Better error handling when killing the BE process.

Catch the ESRCH error when terminating non-existing backend process.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-09-07 14:48:37 +02:00 committed by Akos Kitta
parent ec8df37c2d
commit daa25794ef

View File

@ -286,7 +286,15 @@ app.on('ready', () => {
app.on('quit', () => {
// If we forked the process for the clusters, we need to manually terminate it.
// See: https://github.com/eclipse-theia/theia/issues/835
process.kill(cp.pid);
try {
process.kill(cp.pid);
} catch (e) {
if (e.code === 'ESRCH') {
console.log('Could not terminate the backend process. It was not running.');
return;
}
throw e;
}
});
}
});