Browse Source

Merge pull request #6198 from Rob--W/windows-taskkill

Use taskkill to stop the browser on Windows in tests
Brendan Dahl 10 years ago
parent
commit
e498bbce90
  1. 12
      test/webbrowser.js

12
test/webbrowser.js

@ -24,6 +24,7 @@ var fs = require('fs'); @@ -24,6 +24,7 @@ var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var testUtils = require('./testutils.js');
var shelljs = require('shelljs');
var tempDirPrefix = 'pdfjs_';
@ -96,9 +97,20 @@ WebBrowser.prototype = { @@ -96,9 +97,20 @@ WebBrowser.prototype = {
}
if (this.process) {
if (process.platform === 'win32') {
// process.kill is not reliable on Windows (Firefox sticks around). The
// work-around was to manually open the task manager and terminate the
// process. Instead of doing that manually, use taskkill to kill.
// (https://technet.microsoft.com/en-us/library/cc725602.aspx)
var result = shelljs.exec('taskkill /f /t /pid ' + this.process.pid);
if (result.code) {
console.error('taskkill failed with exit code ' + result.code);
}
} else {
this.process.kill('SIGTERM');
}
}
}
};
var firefoxResourceDir = path.join(__dirname, 'resources', 'firefox');

Loading…
Cancel
Save