From daa25794ef2763d496412c74dc143c9614cac9f6 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Mon, 7 Sep 2020 14:48:37 +0200 Subject: [PATCH] Better error handling when killing the BE process. Catch the ESRCH error when terminating non-existing backend process. Signed-off-by: Akos Kitta --- electron/build/patch/electron-main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electron/build/patch/electron-main.js b/electron/build/patch/electron-main.js index 4e642ba5..3e314741 100644 --- a/electron/build/patch/electron-main.js +++ b/electron/build/patch/electron-main.js @@ -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; + } }); } });