@@ -263,17 +263,13 @@ async function serveFile(filePath, isSingleFile = false, fileName = null) {
263263 console . log ( `ℹ️ Please open your browser and navigate to: ${ url } ` ) ;
264264 }
265265
266- let sigintHandled = false ;
267- process . on ( 'SIGINT' , async ( ) => {
268- if ( ! sigintHandled ) {
269- sigintHandled = true ;
270- console . log ( `${ os . EOL } 🛑 Stopping server...` ) ;
271- serveProcess . kill ( 'SIGINT' ) ;
272- if ( tmpDir ) {
273- try { await fs . promises . rm ( tmpDir , { recursive : true , force : true } ) ; } catch { }
274- }
275- process . exit ( 0 ) ;
266+ process . once ( 'SIGINT' , async ( ) => {
267+ console . log ( `${ os . EOL } 🛑 Stopping server...` ) ;
268+ serveProcess . kill ( 'SIGINT' ) ;
269+ if ( tmpDir ) {
270+ try { await fs . promises . rm ( tmpDir , { recursive : true , force : true } ) ; } catch { }
276271 }
272+ process . exit ( 0 ) ;
277273 } ) ;
278274
279275 await new Promise ( ( resolve ) => { serveProcess . on ( 'exit' , resolve ) ; } ) ;
@@ -427,13 +423,9 @@ async function main() {
427423 console . log ( `${ os . EOL } 💡 Press Ctrl+C to stop the preview server` ) ;
428424 } , 5000 ) ;
429425
430- let sigintHandled = false ;
431- process . on ( 'SIGINT' , ( ) => {
432- if ( ! sigintHandled ) {
433- sigintHandled = true ;
434- console . log ( `${ os . EOL } 🛑 Stopping artifact...` ) ;
435- runProcess . kill ( 'SIGINT' ) ;
436- }
426+ process . once ( 'SIGINT' , ( ) => {
427+ console . log ( `${ os . EOL } 🛑 Stopping artifact...` ) ;
428+ runProcess . kill ( 'SIGINT' ) ;
437429 } ) ;
438430
439431 await new Promise ( ( resolve ) => {
@@ -455,13 +447,9 @@ async function main() {
455447 console . log ( `${ os . EOL } 💡 Press Ctrl+C to stop the development server` ) ;
456448 } , 5000 ) ;
457449
458- let sigintHandled = false ;
459- process . on ( 'SIGINT' , ( ) => {
460- if ( ! sigintHandled ) {
461- sigintHandled = true ;
462- console . log ( `${ os . EOL } 🛑 Stopping artifact...` ) ;
463- runProcess . kill ( 'SIGINT' ) ;
464- }
450+ process . once ( 'SIGINT' , ( ) => {
451+ console . log ( `${ os . EOL } 🛑 Stopping artifact...` ) ;
452+ runProcess . kill ( 'SIGINT' ) ;
465453 } ) ;
466454
467455 await new Promise ( ( resolve ) => {
0 commit comments