This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed
src/service/async_task_service Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -39,19 +39,23 @@ export class QuickInstallTask extends AsyncTask {
3939
4040 private download ( ) : Promise < boolean > {
4141 return new Promise ( async ( resolve , reject ) => {
42- this . zipPath = path . normalize ( path . join ( this . instance . config . cwd , this . TMP_ZIP_NAME ) ) ;
43- const writeStream = fs . createWriteStream ( this . zipPath ) ;
44- const response = await axios < Readable > ( {
45- url : this . targetLink ,
46- responseType : "stream"
47- } ) ;
48- this . downloadStream = pipeline ( response . data , writeStream , ( err ) => {
49- if ( err ) {
50- reject ( err ) ;
51- } else {
52- resolve ( true ) ;
53- }
54- } ) ;
42+ try {
43+ this . zipPath = path . normalize ( path . join ( this . instance . config . cwd , this . TMP_ZIP_NAME ) ) ;
44+ const writeStream = fs . createWriteStream ( this . zipPath ) ;
45+ const response = await axios < Readable > ( {
46+ url : this . targetLink ,
47+ responseType : "stream"
48+ } ) ;
49+ this . downloadStream = pipeline ( response . data , writeStream , ( err ) => {
50+ if ( err ) {
51+ reject ( err ) ;
52+ } else {
53+ resolve ( true ) ;
54+ }
55+ } ) ;
56+ } catch ( error ) {
57+ reject ( error ) ;
58+ }
5559 } ) ;
5660 }
5761
You can’t perform that action at this time.
0 commit comments