From ff6e0298536b5d336c7b3d752929f8879905f92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Fri, 6 Apr 2018 11:51:43 +0200 Subject: [PATCH 1/2] GPII-2844: Changed function error handling with promise rejection --- .../processHandling/processHandling.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gpii/node_modules/processHandling/processHandling.js b/gpii/node_modules/processHandling/processHandling.js index 0eb5e0286..c1413229a 100644 --- a/gpii/node_modules/processHandling/processHandling.js +++ b/gpii/node_modules/processHandling/processHandling.js @@ -411,18 +411,21 @@ gpii.windows.restartExplorer = function () { : fluid.toPromise(gpii.windows.currentRestartSession); shutdownPromise.then(function (session) { - try { - // Re-start the explorer process. - var result = rm.RmRestart(session, 0, ref.NULL); - if (result) { - throw windows.win32error("RmRestart", result); - } + // Re-start the explorer process. + var result = rm.RmRestart(session, 0, ref.NULL); - } finally { - rm.RmEndSession(session); - gpii.windows.currentRestartSession = null; + if (result) { + promiseTogo.reject({ + isError: true, + message: "RmRestart: " + result + }); + } else { + promiseTogo.resolve(); } - promiseTogo.resolve(); + + rm.RmEndSession(session); + gpii.windows.currentRestartSession = null; + }); return promiseTogo; From 1e882c33bd99e0e5bbadb57ab16d769b2411234d Mon Sep 17 00:00:00 2001 From: ste Date: Thu, 9 Aug 2018 23:02:30 +0100 Subject: [PATCH 2/2] GPII-2844: Forcing explorer death. --- gpii/node_modules/processHandling/processHandling.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gpii/node_modules/processHandling/processHandling.js b/gpii/node_modules/processHandling/processHandling.js index 0eb5e0286..b05aa01b1 100644 --- a/gpii/node_modules/processHandling/processHandling.js +++ b/gpii/node_modules/processHandling/processHandling.js @@ -384,6 +384,10 @@ gpii.windows.stopExplorer = function () { promise.resolve(session); } }); + // It sometimes fails, so kill it manually after a few seconds. + windows.waitForProcessTermination(explorerPid, { timeout: 5000 }).then(null, function () { + process.kill(explorerPid); + }); } } } else {