From 98ab547140a6cefd6c954389dc9cb02baa37fdaa Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Thu, 17 Apr 2014 07:32:58 -0500 Subject: [PATCH] Fixes webbrowser.js to avoid undefined callback call --- test/webbrowser.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/webbrowser.js b/test/webbrowser.js index 24d72a757..8c36432d4 100644 --- a/test/webbrowser.js +++ b/test/webbrowser.js @@ -74,18 +74,14 @@ WebBrowser.prototype = { try { testUtils.removeDirSync(this.tmpDir); this.process = null; - callback(); + if (callback) { + callback(); + } } catch (e) { console.error('Unable to cleanup after the process: ' + e); try { if (this.process) { - var pid = this.process.pid; - if (process.platform === 'win32') { - // kill does not really work on windows - spawn('taskkill', ['-F', '-PID', pid]).on('exit', callback); - } else { - spawn('kill', ['-s', 'SIGKILL', pid]).on('exit', callback); - } + this.process.kill('SIGKILL'); } } catch (e) {} }