diff --git a/gpii/node_modules/processHandling/processHandling.js b/gpii/node_modules/processHandling/processHandling.js index 26e995f1f..88a0ec27e 100644 --- a/gpii/node_modules/processHandling/processHandling.js +++ b/gpii/node_modules/processHandling/processHandling.js @@ -387,6 +387,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 { @@ -414,18 +418,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;