File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ function LocalBinary(){
28
28
29
29
var destBinaryName = ( this . windows ) ? 'BrowserStackLocal.exe' : 'BrowserStackLocal' ;
30
30
var binaryPath = path . join ( destParentDir , destBinaryName ) ;
31
- var file = fs . createWriteStream ( binaryPath ) ;
31
+ var fileStream = fs . createWriteStream ( binaryPath ) ;
32
32
33
33
var options = url . parse ( this . httpPath ) ;
34
34
if ( conf . proxyHost && conf . proxyPort ) {
@@ -39,12 +39,15 @@ function LocalBinary(){
39
39
}
40
40
41
41
https . get ( options , function ( response ) {
42
- response . on ( 'end' , function ( ) {
42
+ response . pipe ( fileStream ) ;
43
+ fileStream . on ( 'error' , function ( err ) {
44
+ console . error ( 'Got Error while downloading binary file' , err ) ;
45
+ } ) ;
46
+ fileStream . on ( 'close' , function ( ) {
43
47
fs . chmod ( binaryPath , '0755' , function ( ) {
44
48
callback ( binaryPath ) ;
45
49
} ) ;
46
50
} ) ;
47
- response . pipe ( file ) ;
48
51
} ) ;
49
52
} ;
50
53
You can’t perform that action at this time.
0 commit comments