Skip to content

Commit

Permalink
Print exit reason with signals information
Browse files Browse the repository at this point in the history
  • Loading branch information
oxidase committed Sep 5, 2016
1 parent 59be6d6 commit f95f1f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions features/lib/osrm_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class OSRMDirectLoader extends OSRMBaseLoader {

this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => {
if (err) {
throw new Error(util.format('osrm-routed exited with code %d', err.code));
let reason = err.killed ? util.format('killed by %s', err.signal) : util.format('exited with code %d', err.code);
throw new Error(util.format('osrm-routed %s: %s', reason, err.cmd));
}
});
callback();
Expand Down Expand Up @@ -111,9 +112,10 @@ 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) {
throw new Error(util.format('osrm-routed exited with code %d: %s', err.code, err));
}
if (err) {
let reason = err.killed ? util.format('killed by %s', err.signal) : util.format('exited with code %d', err.code);
throw new Error(util.format('osrm-routed %s: %s', reason, err.cmd));
}
});

// we call the callback here, becuase we don't want to wait for the child process to finish
Expand Down

0 comments on commit f95f1f2

Please sign in to comment.