Skip to content

Commit 84f6230

Browse files
committed
Add exit handler debug logs
1 parent bf2b63b commit 84f6230

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/src/hooks/use-exit-handler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export const useExitHandler = ({
5555
}
5656
exitScheduledRef.current = true
5757

58+
console.log('[exit-handler] exitNow invoked')
59+
5860
if (exitWarningTimeoutRef.current) {
5961
clearTimeout(exitWarningTimeoutRef.current)
6062
exitWarningTimeoutRef.current = null
@@ -101,18 +103,21 @@ export const useExitHandler = ({
101103
}
102104

103105
if (!nextCtrlCWillExit) {
106+
console.log('[exit-handler] first Ctrl+C detected; showing warning')
104107
setNextCtrlCWillExit(true)
105108
exitWarningTimeoutRef.current = setTimeout(() => {
106109
setNextCtrlCWillExit(false)
107110
exitWarningTimeoutRef.current = null
108111
}, 2000)
109112
// Fallback: if a second Ctrl+C is not detected, exit after a short grace period
110113
exitFallbackTimeoutRef.current = setTimeout(() => {
114+
console.log('[exit-handler] fallback exit triggered after warning window')
111115
exitNow()
112116
}, 1200)
113117
return true
114118
}
115119

120+
console.log('[exit-handler] second Ctrl+C detected; exiting')
116121
// Fire-and-forget analytics flush so exit is not blocked
117122
void flushAnalyticsWithTimeout()
118123
exitNow()
@@ -121,6 +126,7 @@ export const useExitHandler = ({
121126

122127
useEffect(() => {
123128
const handleSigint = () => {
129+
console.log('[exit-handler] SIGINT received; exiting')
124130
void flushAnalyticsWithTimeout()
125131
exitNow()
126132
}

0 commit comments

Comments
 (0)