clean exits (#6886)

* clean exits

* cleanup
This commit is contained in:
pashpashpash authored and GitHub committed 2025-10-15 08:37:51 -07:00
1 parent 65e5f0feb7
commit f47d07784a
3 files changed
+35

No files matched your search

+13
View File
@@ -121,6 +121,10 @@ func HandleAuthMenuNoArgs(ctx context.Context) error {
action, err := ShowAuthMenuWithStatus(isClineAuth, hasOrganizations, currentProvider, currentModel)
if err != nil {
// Check if user cancelled - propagate for clean exit
if err == huh.ErrUserAborted {
return huh.ErrUserAborted
}
return err
}
@@ -202,6 +206,11 @@ func ShowAuthMenuWithStatus(isClineAuthenticated bool, hasOrganizations bool, cu
)
if err := form.Run(); err != nil {
// Check if user cancelled with Control-C
if err == huh.ErrUserAborted {
// Return the error to allow deferred cleanup to run
return "", huh.ErrUserAborted
}
return "", fmt.Errorf("failed to get menu choice: %w", err)
}
@@ -268,6 +277,10 @@ func HandleSelectProvider(ctx context.Context) error {
)
if err := form.Run(); err != nil {
// Check if user cancelled with Control-C
if err == huh.ErrUserAborted {
return huh.ErrUserAborted
}
return fmt.Errorf("failed to select provider: %w", err)
}