Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 4f001c3

Browse files
Fix stalling travis builds
1 parent 8c44ec2 commit 4f001c3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

gulpfile.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ gulp.task('default', ['build', 'test']);
2424
gulp.task('build', ['scripts']);
2525
gulp.task('test', ['build', 'protractor', 'karma']);
2626
gulp.task('ci', ['protractor-sauce','karma-sauce'], function() {
27-
sauceConnectProcess.close(function() {
28-
console.log("Closed Sauce Connect process");
29-
});
27+
closeSauceConnect();
3028
});
3129

3230
gulp.task('watch', ['build', 'karma-watch'], function() {
@@ -105,6 +103,12 @@ gulp.task('start-sauce-connect', function(callback) {
105103
});
106104
});
107105

106+
function closeSauceConnect() {
107+
sauceConnectProcess.close(function() {
108+
console.log("Closed Sauce Connect process");
109+
});
110+
}
111+
108112
gulp.task('karma-sauce', ['build', 'start-sauce-connect'], function(callback) {
109113
var customLaunchers = geSaLaKaCuLa({
110114
'Windows 7': {
@@ -121,6 +125,9 @@ gulp.task('karma-sauce', ['build', 'start-sauce-connect'], function(callback) {
121125
karma: Server,
122126
customLaunchers: customLaunchers
123127
}, function(code) {
128+
if (code) {
129+
closeSauceConnect();
130+
}
124131
callback(code);
125132
});
126133
});
@@ -145,6 +152,7 @@ var runProtractor = function(configFile, callback) {
145152
'autoStartStopServer': true
146153
}))
147154
.on('error', function(e) {
155+
closeSauceConnect();
148156
callback(e);
149157
})
150158
.on('end', function() {

0 commit comments

Comments
 (0)