Skip to content

Commit

Permalink
Merge pull request #10 from johanneswuerbach/close-callback
Browse files Browse the repository at this point in the history
Adds missing close callback.
  • Loading branch information
bermi committed Jul 16, 2013
2 parents 095ee26 + 2b7a810 commit 3866a00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/sauce-connect-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ function run(options, callback) {

openProcesses.push(child);

child.close = function () {
child.close = function (closeCallback) {
if (closeCallback) {
child.on("close", function () {
closeCallback();
});
}
child.kill("SIGTERM");
};
}
Expand Down
10 changes: 10 additions & 0 deletions test/sauce-connect-launcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ describe("Sauce Connect Launcher", function () {
done();
});
});

it("should execute a provided close callback", function (done) {
sauceConnectLauncher(sauceCreds, function (err, sauceConnectProcess) {
if (err) { throw err; }
expect(sauceConnectProcess).to.be.ok();
sauceConnectProcess.close(function () {
done();
});
});
});
}

});

0 comments on commit 3866a00

Please sign in to comment.