File tree 2 files changed +21
-6
lines changed
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -259,13 +259,17 @@ function Local(){
259
259
var killChecker = setInterval ( ( ) => {
260
260
if ( childPids . length === 0 ) {
261
261
clearInterval ( killChecker ) ;
262
- process . kill ( this . pid ) ;
263
-
264
- // This gives time to local binary to send kill signal to railsApp.
265
- setTimeout ( ( ) => {
262
+ try {
263
+ process . kill ( this . pid ) ;
264
+ // This gives time to local binary to send kill signal to railsApp.
265
+ setTimeout ( ( ) => {
266
+ this . isProcessRunning = false ;
267
+ callback ( ) ;
268
+ } , 2000 ) ;
269
+ } catch ( err ) {
266
270
this . isProcessRunning = false ;
267
271
callback ( ) ;
268
- } , 2000 ) ;
272
+ }
269
273
}
270
274
for ( var i in childPids ) {
271
275
try {
@@ -274,7 +278,7 @@ function Local(){
274
278
childPids . splice ( i , 1 ) ;
275
279
}
276
280
}
277
- } , 100 ) ;
281
+ } , 500 ) ;
278
282
} ) ;
279
283
} ;
280
284
}
Original file line number Diff line number Diff line change @@ -210,6 +210,17 @@ describe('Local', function () {
210
210
} ) ;
211
211
} ) ;
212
212
213
+ it ( 'should stop local' , function ( done ) {
214
+ this . timeout ( MAX_TIMEOUT ) ;
215
+ bsLocal . start ( { 'key' : process . env . BROWSERSTACK_ACCESS_KEY } , function ( ) {
216
+ expect ( bsLocal . isRunning ( ) ) . to . equal ( true ) ;
217
+ bsLocal . stop ( function ( ) {
218
+ expect ( bsLocal . isRunning ( ) ) . to . equal ( false ) ;
219
+ done ( ) ;
220
+ } ) ;
221
+ } ) ;
222
+ } ) ;
223
+
213
224
afterEach ( function ( done ) {
214
225
this . timeout ( 60000 ) ;
215
226
bsLocal . stop ( done ) ;
You can’t perform that action at this time.
0 commit comments