File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,18 @@ export const useExitHandler = ({
4040 const exitWarningTimeoutRef = useRef < ReturnType < typeof setTimeout > | null > (
4141 null ,
4242 )
43+ const exitScheduledRef = useRef ( false )
4344
4445 useEffect ( ( ) => {
4546 setupExitMessageHandler ( )
4647 } , [ ] )
4748
4849 const exitNow = useCallback ( ( ) => {
50+ if ( exitScheduledRef . current ) {
51+ return
52+ }
53+ exitScheduledRef . current = true
54+
4955 if ( exitWarningTimeoutRef . current ) {
5056 clearTimeout ( exitWarningTimeoutRef . current )
5157 exitWarningTimeoutRef . current = null
@@ -56,7 +62,11 @@ export const useExitHandler = ({
5662 } catch {
5763 // Ignore stdout write errors during shutdown
5864 }
59- process . exit ( 0 )
65+
66+ // Give the terminal a moment to render the exit message before terminating
67+ setTimeout ( ( ) => {
68+ process . exit ( 0 )
69+ } , 25 )
6070 } , [ ] )
6171
6272 const flushAnalyticsWithTimeout = useCallback ( async ( timeoutMs = 1000 ) => {
You can’t perform that action at this time.
0 commit comments