@@ -53,6 +53,12 @@ export async function runCreateInteractiveCli(): Promise<CreateAppResult> {
5353
5454 const backgroundInstall = backgroundInstallDeps ( pkgManager , baseApp ) ;
5555
56+ const cancelProcess = async ( ) => {
57+ await backgroundInstall . abort ( ) ;
58+ cancel ( 'Operation cancelled.' ) ;
59+ process . exit ( 0 ) ;
60+ } ;
61+
5662 log . info ( `Creating new project in ${ bgBlue ( ' ' + outDir + ' ' ) } ... 🐇` ) ;
5763
5864 let removeExistingOutDirPromise : Promise < void | void [ ] > | null = null ;
@@ -70,8 +76,7 @@ export async function runCreateInteractiveCli(): Promise<CreateAppResult> {
7076 } ) ;
7177
7278 if ( isCancel ( existingOutDirAnswer ) || existingOutDirAnswer === 'exit' ) {
73- cancel ( 'Operation cancelled.' ) ;
74- process . exit ( 0 ) ;
79+ return await cancelProcess ( ) ;
7580 }
7681
7782 if ( existingOutDirAnswer === 'replace' ) {
@@ -86,8 +91,7 @@ export async function runCreateInteractiveCli(): Promise<CreateAppResult> {
8691 } ) ;
8792
8893 if ( isCancel ( starterIdAnswer ) ) {
89- cancel ( 'Operation cancelled.' ) ;
90- process . exit ( 0 ) ;
94+ return await cancelProcess ( ) ;
9195 }
9296
9397 const starterId = starterIdAnswer as string ;
@@ -98,8 +102,7 @@ export async function runCreateInteractiveCli(): Promise<CreateAppResult> {
98102 } ) ;
99103
100104 if ( isCancel ( runDepInstallAnswer ) ) {
101- cancel ( 'Operation cancelled.' ) ;
102- process . exit ( 0 ) ;
105+ return await cancelProcess ( ) ;
103106 }
104107
105108 const gitInitAnswer = await confirm ( {
0 commit comments