Skip to content

Commit daa2579

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
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>
1 parent ec8df37 commit daa2579

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

electron/build/patch/electron-main.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ app.on('ready', () => {
286286
app.on('quit', () => {
287287
// If we forked the process for the clusters, we need to manually terminate it.
288288
// See: https://github.com/eclipse-theia/theia/issues/835
289-
process.kill(cp.pid);
289+
try {
290+
process.kill(cp.pid);
291+
} catch (e) {
292+
if (e.code === 'ESRCH') {
293+
console.log('Could not terminate the backend process. It was not running.');
294+
return;
295+
}
296+
throw e;
297+
}
290298
});
291299
}
292300
});

0 commit comments

Comments
 (0)