1
1
var fs = require ( 'fs' ) ,
2
2
childProcess = require ( 'child_process' ) ,
3
- os = require ( 'os' ) ,
4
3
ZipBinary = require ( './ZipBinary' ) ,
5
- log = require ( './helper' ) . log ;
4
+ helper = require ( './helper' ) ,
5
+ log = helper . log ;
6
6
7
7
function BrowserStackTunnel ( options ) {
8
+ if ( options . path ) {
9
+ helper . setBasePath ( options . path ) ;
10
+ }
11
+
8
12
var params = [ ] ,
9
13
startCallback = null ,
10
14
stopCallback = null ,
@@ -20,22 +24,22 @@ function BrowserStackTunnel(options) {
20
24
} ;
21
25
22
26
var binary ;
23
- switch ( os . platform ( ) ) {
27
+ switch ( helper . getPlatform ( ) ) {
24
28
case 'linux' :
25
- switch ( os . arch ( ) ) {
29
+ switch ( helper . getArch ( ) ) {
26
30
case 'x64' :
27
- binary = new ZipBinary ( 'linux' , 'x64' , options . path ) ;
31
+ binary = new ZipBinary ( 'linux' , 'x64' ) ;
28
32
break ;
29
33
case 'ia32' :
30
- binary = new ZipBinary ( 'linux' , 'ia32' , options . path ) ;
34
+ binary = new ZipBinary ( 'linux' , 'ia32' ) ;
31
35
break ;
32
36
}
33
37
break ;
34
38
case 'darwin' :
35
- binary = new ZipBinary ( 'darwin' , 'x64' , options . path ) ;
39
+ binary = new ZipBinary ( 'darwin' , 'x64' ) ;
36
40
break ;
37
41
default :
38
- binary = new ZipBinary ( 'win32' , null , options . path , 'exe' ) ;
42
+ binary = new ZipBinary ( 'win32' , null ) ;
39
43
break ;
40
44
}
41
45
@@ -51,7 +55,7 @@ function BrowserStackTunnel(options) {
51
55
}
52
56
53
57
if ( options . verbose ) {
54
- params . push ( '-v ' ) ;
58
+ params . push ( '-vvv ' ) ;
55
59
}
56
60
57
61
if ( options . force ) {
@@ -96,6 +100,7 @@ function BrowserStackTunnel(options) {
96
100
} ;
97
101
98
102
this . updateState = function ( data ) {
103
+ helper . logBinaryOutput ( data . toString ( ) ) ;
99
104
var state ;
100
105
this . stdoutData += data . toString ( ) ;
101
106
for ( state in this . stateMatchers ) {
@@ -163,7 +168,7 @@ function BrowserStackTunnel(options) {
163
168
164
169
this . startTunnel = function ( ) {
165
170
var self = this ;
166
- if ( ! fs . existsSync ( binary . path ) ) {
171
+ if ( ! fs . existsSync ( helper . getBinaryPath ( ) ) ) {
167
172
log . warn ( 'Binary not present' ) ;
168
173
binary . update ( function ( ) {
169
174
self . _startTunnel ( ) ;
0 commit comments