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(){
2828
2929 var destBinaryName = ( this . windows ) ? 'BrowserStackLocal.exe' : 'BrowserStackLocal' ;
3030 var binaryPath = path . join ( destParentDir , destBinaryName ) ;
31- var file = fs . createWriteStream ( binaryPath ) ;
31+ var fileStream = fs . createWriteStream ( binaryPath ) ;
3232
3333 var options = url . parse ( this . httpPath ) ;
3434 if ( conf . proxyHost && conf . proxyPort ) {
@@ -39,12 +39,15 @@ function LocalBinary(){
3939 }
4040
4141 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 ( ) {
4347 fs . chmod ( binaryPath , '0755' , function ( ) {
4448 callback ( binaryPath ) ;
4549 } ) ;
4650 } ) ;
47- response . pipe ( file ) ;
4851 } ) ;
4952 } ;
5053
You can’t perform that action at this time.
0 commit comments