File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const inquirer = require('inquirer');
1818const { progressStream } = require ( './utils/download' ) ;
1919const { getGitHubAuthToken } = require ( './utils/github-auth' ) ;
2020const { current } = require ( './evm-config' ) ;
21- const { color, fatal } = require ( './utils/logging' ) ;
21+ const { color, fatal, logError } = require ( './utils/logging' ) ;
2222
2323const d = require ( 'debug' ) ( 'build-tools:pr' ) ;
2424
@@ -407,19 +407,17 @@ Proceed?`,
407407 throw new Error ( `${ executableName } not found within dist.zip.` ) ;
408408 }
409409
410- // Cleanup temporary files
411- await fs . promises . rm ( tempDir , { recursive : true } ) ;
412-
413410 console . log ( `${ color . success } Downloaded to ${ outputDir } ` ) ;
414411 } catch ( error ) {
412+ logError ( error ) ;
413+ process . exitCode = 1 ; // wait for cleanup
414+ } finally {
415415 // Cleanup temporary files
416416 try {
417417 await fs . promises . rm ( tempDir , { recursive : true } ) ;
418418 } catch {
419419 // ignore
420420 }
421-
422- fatal ( error ) ;
423421 }
424422 } ) ;
425423
Original file line number Diff line number Diff line change @@ -20,16 +20,21 @@ const color = {
2020 warn : chalk . bgYellowBright . black ( 'WARN' ) ,
2121} ;
2222
23- function fatal ( e , code = 1 ) {
23+ function logError ( e ) {
2424 if ( typeof e === 'string' ) {
2525 console . error ( `${ color . err } ${ e } ` ) ;
2626 } else {
2727 console . error ( `${ color . err } ${ e . stack ? e . stack : e . message } ` ) ;
2828 }
29+ }
30+
31+ function fatal ( e , code = 1 ) {
32+ logError ( e ) ;
2933 process . exit ( code ) ;
3034}
3135
3236module . exports = {
3337 color,
3438 fatal,
39+ logError,
3540} ;
You can’t perform that action at this time.
0 commit comments