Fixes webbrowser.js to avoid undefined callback call

This commit is contained in:
Yury Delendik 2014-04-17 07:32:58 -05:00
parent 339f8f0ac9
commit 98ab547140

View File

@ -74,18 +74,14 @@ WebBrowser.prototype = {
try { try {
testUtils.removeDirSync(this.tmpDir); testUtils.removeDirSync(this.tmpDir);
this.process = null; this.process = null;
callback(); if (callback) {
callback();
}
} catch (e) { } catch (e) {
console.error('Unable to cleanup after the process: ' + e); console.error('Unable to cleanup after the process: ' + e);
try { try {
if (this.process) { if (this.process) {
var pid = this.process.pid; this.process.kill('SIGKILL');
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);
}
} }
} catch (e) {} } catch (e) {}
} }