File tree Expand file tree Collapse file tree
packages/create-react-native-library/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,6 +154,8 @@ async function create() {
154154 } else {
155155 spinner . text = 'Initializing git repository' ;
156156
157+ let timer ;
158+
157159 try {
158160 const abortController = new AbortController ( ) ;
159161
@@ -163,7 +165,7 @@ async function create() {
163165 await Promise . race ( [
164166 createInitialGitCommit ( folder , abortController . signal ) ,
165167 new Promise < void > ( ( _resolve , reject ) => {
166- setTimeout ( ( ) => {
168+ timer = setTimeout ( ( ) => {
167169 const error = new Error ( 'Creating git repository took too long' ) ;
168170
169171 abortController . abort ( error . message ) ;
@@ -173,6 +175,9 @@ async function create() {
173175 ] ) ;
174176 } catch ( error ) {
175177 spinner . warn ( 'Failed to create git repository' ) ;
178+ } finally {
179+ // The process waits for the timer if we don't clear it here
180+ clearTimeout ( timer ) ;
176181 }
177182
178183 printSuccessMessage ( ) ;
You can’t perform that action at this time.
0 commit comments