Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Ensure sauce connection is closed on errors #22

Merged
merged 3 commits into from Jan 7, 2017

Conversation

jstockwin
Copy link
Contributor

cc @webteckie

I think this may (at least help) to solve some of those problems where travis doesn't close the sauce tunnel on error.

Even if not, I think this is something we should be doing now we're handling the connection manually. What do you think?

@@ -81,6 +82,7 @@ function startSauceConnect (done) {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think execution will fall through here and hit the following code so you need to do else.

callback && callback(err);
if (sauceConnectionRunning) {
console.log([moment().format('HH:mm:ss:SSS')] + ' e2e: something seems to have gone wrong, stopping sauce connect before travis shuts down');
stopSauceConnect(callback && callback(err));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel right. The callback will be evaluated and called here before stopSauceConnect is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I wasn't sure here. What should it be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to pass in a function that itself calls the call back:
stopSauceConnect( function () {callback && callback(err)})

@jstockwin jstockwin merged commit a4a3a55 into master Jan 7, 2017
@jstockwin jstockwin deleted the sauce-connection-closing branch January 7, 2017 23:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants