try to fix npm tests on windows by direct data loading
This commit is contained in:
parent
b8f631f6f6
commit
71044e88f3
@ -36,9 +36,8 @@ class OSRMBaseLoader{
|
|||||||
|
|
||||||
osrmDown (callback) {
|
osrmDown (callback) {
|
||||||
if (this.osrmIsRunning()) {
|
if (this.osrmIsRunning()) {
|
||||||
this.child.on('exit', (code, signal) => {callback();});
|
this.child.on('exit', (code, signal) => { callback();});
|
||||||
this.child.down = true;
|
this.child.kill('SIGINT');
|
||||||
this.child.kill();
|
|
||||||
} else callback();
|
} else callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ class OSRMDirectLoader extends OSRMBaseLoader {
|
|||||||
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
|
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) => {
|
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));
|
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();
|
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) => {
|
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));
|
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -27,10 +27,11 @@ module.exports = function () {
|
|||||||
return callback(new Error('*** '+stxxl_config+ 'does not exist'));
|
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_ENVIRONMENT = Object.assign({STXXLCFG: stxxl_config}, process.env);
|
||||||
this.DEFAULT_PROFILE = 'bicycle';
|
this.DEFAULT_PROFILE = 'bicycle';
|
||||||
this.DEFAULT_INPUT_FORMAT = 'osm';
|
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.DEFAULT_ORIGIN = [1,1];
|
||||||
this.OSM_USER = 'osrm';
|
this.OSM_USER = 'osrm';
|
||||||
this.OSM_GENERATOR = 'osrm-test';
|
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.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
||||||
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
||||||
|
|
||||||
if (process.platform.match(/^win.*/)) {
|
if (this.PLATFORM_WINDOWS) {
|
||||||
this.TERMSIGNAL = 9;
|
this.TERMSIGNAL = 9;
|
||||||
this.EXE = '.exe';
|
this.EXE = '.exe';
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user