File tree Expand file tree Collapse file tree
packages/chronicle/src/cli/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,4 +28,16 @@ export const devCommand = new Command('dev')
2828
2929 await server . listen ( ) ;
3030 server . printUrls ( ) ;
31+
32+ let shuttingDown = false ;
33+ const shutdown = async ( ) => {
34+ if ( shuttingDown ) return ;
35+ shuttingDown = true ;
36+ try {
37+ await server . close ( ) ;
38+ } catch { /* ignore close errors */ }
39+ process . exit ( 0 ) ;
40+ } ;
41+ process . once ( 'SIGINT' , shutdown ) ;
42+ process . once ( 'SIGTERM' , shutdown ) ;
3143 } ) ;
Original file line number Diff line number Diff line change @@ -26,4 +26,16 @@ export const startCommand = new Command('start')
2626 } ) ;
2727
2828 server . printUrls ( ) ;
29+
30+ let shuttingDown = false ;
31+ const shutdown = async ( ) => {
32+ if ( shuttingDown ) return ;
33+ shuttingDown = true ;
34+ try {
35+ await server . close ( ) ;
36+ } catch { /* ignore close errors */ }
37+ process . exit ( 0 ) ;
38+ } ;
39+ process . once ( 'SIGINT' , shutdown ) ;
40+ process . once ( 'SIGTERM' , shutdown ) ;
2941 } ) ;
You can’t perform that action at this time.
0 commit comments