From 7596481a9d537715ce74309b2b3da85d192d059a Mon Sep 17 00:00:00 2001 From: Shehab <127568346+dizzydroid@users.noreply.github.com> Date: Thu, 7 Aug 2025 20:26:55 +0300 Subject: [PATCH] feat(cli): Allow Exiting Authentication Menu with CTRL+C (SIGINT) (#4482) Co-authored-by: Seth Troisi --- packages/cli/src/ui/App.tsx | 4 ++++ packages/cli/src/ui/components/AuthInProgress.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 2be681e5..d311facf 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -632,6 +632,10 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { ) { setShowIDEContextDetail((prev) => !prev); } else if (key.ctrl && (input === 'c' || input === 'C')) { + if (isAuthenticating) { + // Let AuthInProgress component handle the input. + return; + } handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef); } else if (key.ctrl && (input === 'd' || input === 'D')) { if (buffer.text.length > 0) { diff --git a/packages/cli/src/ui/components/AuthInProgress.tsx b/packages/cli/src/ui/components/AuthInProgress.tsx index 196097f2..f05efe1d 100644 --- a/packages/cli/src/ui/components/AuthInProgress.tsx +++ b/packages/cli/src/ui/components/AuthInProgress.tsx @@ -18,8 +18,8 @@ export function AuthInProgress({ }: AuthInProgressProps): React.JSX.Element { const [timedOut, setTimedOut] = useState(false); - useInput((_, key) => { - if (key.escape) { + useInput((input, key) => { + if (key.escape || (key.ctrl && (input === 'c' || input === 'C'))) { onTimeout(); } }); @@ -48,7 +48,8 @@ export function AuthInProgress({ ) : ( - Waiting for auth... (Press ESC to cancel) + Waiting for auth... (Press ESC or CTRL+C to + cancel) )}