@@ -5,6 +5,11 @@ if (process.argv[2] == '--verbose')
55else
66 global . logLevel = "info" ;
77
8+ if ( process . argv [ 2 ] == 'init' ) {
9+ require ( './init.js' ) ;
10+ return ;
11+ }
12+
813var Log = require ( '../lib/logger' ) ,
914 logger = new Log ( global . logLevel ) ,
1015 BrowserStack = require ( 'browserstack' ) ,
@@ -275,19 +280,15 @@ function runTests() {
275280}
276281
277282try {
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 ) } ) ;
291292} catch ( e ) {
292293 console . log ( e ) ;
293294 console . log ( 'Invalid command.' ) ;
0 commit comments