@@ -5,6 +5,11 @@ if (process.argv[2] == '--verbose')
5
5
else
6
6
global . logLevel = "info" ;
7
7
8
+ if ( process . argv [ 2 ] == 'init' ) {
9
+ require ( './init.js' ) ;
10
+ return ;
11
+ }
12
+
8
13
var Log = require ( '../lib/logger' ) ,
9
14
logger = new Log ( global . logLevel ) ,
10
15
BrowserStack = require ( 'browserstack' ) ,
@@ -275,19 +280,15 @@ function runTests() {
275
280
}
276
281
277
282
try {
278
- if ( process . argv [ 2 ] == 'init' ) {
279
- require ( './init.js' ) ;
280
- } else {
281
- var client = BrowserStack . createClient ( {
282
- username : config . username ,
283
- password : config . key
284
- } ) ;
285
- runTests ( ) ;
286
- var pid_file = process . cwd ( ) + '/browserstack-run.pid' ;
287
- fs . writeFileSync ( pid_file , process . pid , 'utf-8' )
288
- process . on ( 'SIGINT' , function ( ) { cleanUpAndExit ( 'SIGINT' , 1 ) } ) ;
289
- process . on ( 'SIGTERM' , function ( ) { cleanUpAndExit ( 'SIGTERM' , config . status ) } ) ;
290
- }
283
+ var client = BrowserStack . createClient ( {
284
+ username : config . username ,
285
+ password : config . key
286
+ } ) ;
287
+ runTests ( ) ;
288
+ var pid_file = process . cwd ( ) + '/browserstack-run.pid' ;
289
+ fs . writeFileSync ( pid_file , process . pid , 'utf-8' )
290
+ process . on ( 'SIGINT' , function ( ) { cleanUpAndExit ( 'SIGINT' , 1 ) } ) ;
291
+ process . on ( 'SIGTERM' , function ( ) { cleanUpAndExit ( 'SIGTERM' , config . status ) } ) ;
291
292
} catch ( e ) {
292
293
console . log ( e ) ;
293
294
console . log ( 'Invalid command.' ) ;
0 commit comments