11var fs = require ( 'fs' ) ,
22 childProcess = require ( 'child_process' ) ,
3- os = require ( 'os' ) ,
43 ZipBinary = require ( './ZipBinary' ) ,
5- log = require ( './helper' ) . log ;
4+ helper = require ( './helper' ) ,
5+ log = helper . log ;
66
77function BrowserStackTunnel ( options ) {
8+ if ( options . path ) {
9+ helper . setBasePath ( options . path ) ;
10+ }
11+
812 var params = [ ] ,
913 startCallback = null ,
1014 stopCallback = null ,
@@ -20,22 +24,22 @@ function BrowserStackTunnel(options) {
2024 } ;
2125
2226 var binary ;
23- switch ( os . platform ( ) ) {
27+ switch ( helper . getPlatform ( ) ) {
2428 case 'linux' :
25- switch ( os . arch ( ) ) {
29+ switch ( helper . getArch ( ) ) {
2630 case 'x64' :
27- binary = new ZipBinary ( 'linux' , 'x64' , options . path ) ;
31+ binary = new ZipBinary ( 'linux' , 'x64' ) ;
2832 break ;
2933 case 'ia32' :
30- binary = new ZipBinary ( 'linux' , 'ia32' , options . path ) ;
34+ binary = new ZipBinary ( 'linux' , 'ia32' ) ;
3135 break ;
3236 }
3337 break ;
3438 case 'darwin' :
35- binary = new ZipBinary ( 'darwin' , 'x64' , options . path ) ;
39+ binary = new ZipBinary ( 'darwin' , 'x64' ) ;
3640 break ;
3741 default :
38- binary = new ZipBinary ( 'win32' , null , options . path , 'exe' ) ;
42+ binary = new ZipBinary ( 'win32' , null ) ;
3943 break ;
4044 }
4145
@@ -51,7 +55,7 @@ function BrowserStackTunnel(options) {
5155 }
5256
5357 if ( options . verbose ) {
54- params . push ( '-v ' ) ;
58+ params . push ( '-vvv ' ) ;
5559 }
5660
5761 if ( options . force ) {
@@ -96,6 +100,7 @@ function BrowserStackTunnel(options) {
96100 } ;
97101
98102 this . updateState = function ( data ) {
103+ helper . logBinaryOutput ( data . toString ( ) ) ;
99104 var state ;
100105 this . stdoutData += data . toString ( ) ;
101106 for ( state in this . stateMatchers ) {
@@ -163,7 +168,7 @@ function BrowserStackTunnel(options) {
163168
164169 this . startTunnel = function ( ) {
165170 var self = this ;
166- if ( ! fs . existsSync ( binary . path ) ) {
171+ if ( ! fs . existsSync ( helper . getBinaryPath ( ) ) ) {
167172 log . warn ( 'Binary not present' ) ;
168173 binary . update ( function ( ) {
169174 self . _startTunnel ( ) ;
0 commit comments