Skip to content

Commit

Permalink
Don't kill osrm-routed in After hook
Browse files Browse the repository at this point in the history
logStream is bounded to a child process lifetime
and is no more deleted in After hook.
  • Loading branch information
oxidase committed Sep 5, 2016
1 parent 59be6d6 commit 9575bc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 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
7 changes: 2 additions & 5 deletions features/support/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ module.exports = function () {
});

this.After((scenario, callback) => {
var that = this;
this.osrmLoader.shutdown(function() {
that.resetOptionsOutput();
callback();
});
this.resetOptionsOutput();
callback();
});

this.AfterFeatures((features, callback) => {
Expand Down

0 comments on commit 9575bc5

Please sign in to comment.