Don't report error if osrm-routed was killed by js script

This commit is contained in:
Michael Krasnyk 2016-12-27 00:43:19 +01:00 committed by Moritz Kobitzsch
parent f8499957fa
commit bd2a5ebe10

View File

@ -37,6 +37,7 @@ class OSRMBaseLoader{
osrmDown (callback) {
if (this.osrmIsRunning()) {
this.child.on('exit', (code, signal) => {callback();});
this.child.down = true;
this.child.kill();
} else callback();
}
@ -78,7 +79,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) {
if (err && !this.child.down) {
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});
@ -115,7 +116,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) {
if (err && !this.child.down) {
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
});