try to fix npm tests on windows by direct data loading

This commit is contained in:
Michael Krasnyk 2017-01-13 14:19:04 +01:00 committed by Patrick Niklaus
parent b8f631f6f6
commit 71044e88f3
2 changed files with 7 additions and 7 deletions

View File

@ -36,9 +36,8 @@ class OSRMBaseLoader{
osrmDown (callback) {
if (this.osrmIsRunning()) {
this.child.on('exit', (code, signal) => {callback();});
this.child.down = true;
this.child.kill();
this.child.on('exit', (code, signal) => { callback();});
this.child.kill('SIGINT');
} else callback();
}
@ -79,7 +78,7 @@ class OSRMDirectLoader extends OSRMBaseLoader {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => {
if (err && !this.child.down) {
if (err && err.signal !== 'SIGINT') {
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});
@ -116,7 +115,7 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
if (this.osrmIsRunning()) return callback();
this.child = this.scope.runBin('osrm-routed', util.format('--shared-memory=1 -p %d', this.scope.OSRM_PORT), this.scope.environment, (err) => {
if (err && !this.child.down) {
if (err && err.signal !== 'SIGINT') {
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});

View File

@ -27,10 +27,11 @@ module.exports = function () {
return callback(new Error('*** '+stxxl_config+ 'does not exist'));
}
this.PLATFORM_WINDOWS = process.platform.match(/^win.*/);
this.DEFAULT_ENVIRONMENT = Object.assign({STXXLCFG: stxxl_config}, process.env);
this.DEFAULT_PROFILE = 'bicycle';
this.DEFAULT_INPUT_FORMAT = 'osm';
this.DEFAULT_LOAD_METHOD = 'datastore';
this.DEFAULT_LOAD_METHOD = this.PLATFORM_WINDOWS ? 'directly' : 'datastore';
this.DEFAULT_ORIGIN = [1,1];
this.OSM_USER = 'osrm';
this.OSM_GENERATOR = 'osrm-test';
@ -42,7 +43,7 @@ module.exports = function () {
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
if (process.platform.match(/^win.*/)) {
if (this.PLATFORM_WINDOWS) {
this.TERMSIGNAL = 9;
this.EXE = '.exe';
} else {