feat(cli): Allow Exiting Authentication Menu with CTRL+C (SIGINT) (#4482)
Co-authored-by: Seth Troisi <sethtroisi@google.com>
This commit is contained in:
parent
8bac9e7d04
commit
7596481a9d
|
@ -632,6 +632,10 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||||
) {
|
) {
|
||||||
setShowIDEContextDetail((prev) => !prev);
|
setShowIDEContextDetail((prev) => !prev);
|
||||||
} else if (key.ctrl && (input === 'c' || input === 'C')) {
|
} else if (key.ctrl && (input === 'c' || input === 'C')) {
|
||||||
|
if (isAuthenticating) {
|
||||||
|
// Let AuthInProgress component handle the input.
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
|
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
|
||||||
} else if (key.ctrl && (input === 'd' || input === 'D')) {
|
} else if (key.ctrl && (input === 'd' || input === 'D')) {
|
||||||
if (buffer.text.length > 0) {
|
if (buffer.text.length > 0) {
|
||||||
|
|
|
@ -18,8 +18,8 @@ export function AuthInProgress({
|
||||||
}: AuthInProgressProps): React.JSX.Element {
|
}: AuthInProgressProps): React.JSX.Element {
|
||||||
const [timedOut, setTimedOut] = useState(false);
|
const [timedOut, setTimedOut] = useState(false);
|
||||||
|
|
||||||
useInput((_, key) => {
|
useInput((input, key) => {
|
||||||
if (key.escape) {
|
if (key.escape || (key.ctrl && (input === 'c' || input === 'C'))) {
|
||||||
onTimeout();
|
onTimeout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -48,7 +48,8 @@ export function AuthInProgress({
|
||||||
) : (
|
) : (
|
||||||
<Box>
|
<Box>
|
||||||
<Text>
|
<Text>
|
||||||
<Spinner type="dots" /> Waiting for auth... (Press ESC to cancel)
|
<Spinner type="dots" /> Waiting for auth... (Press ESC or CTRL+C to
|
||||||
|
cancel)
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue