Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Honour 'ctrl+c' in the UI progress model #764

Merged
merged 1 commit into from May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/kubectl-directpv/progress_model.go
Expand Up @@ -82,6 +82,11 @@ func (m progressModel) Init() tea.Cmd {

func (m progressModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
if msg.String() == "ctrl+c" {
return m, tea.Batch(tea.Sequence(finalPause(), tea.Quit))
}
Praveenrajmani marked this conversation as resolved.
Show resolved Hide resolved
return m, nil
case tea.WindowSizeMsg:
if m.model != nil {
m.model.Width = msg.Width - padding*2 - 4
Expand Down
6 changes: 5 additions & 1 deletion pkg/installer/deployment.go
Expand Up @@ -275,7 +275,11 @@ func doDeleteDeployment(ctx context.Context, name string) error {
return err
}

return deploymentClient.Delete(ctx, name, metav1.DeleteOptions{})
if err = deploymentClient.Delete(ctx, name, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
return err
}

return nil
}

func deleteDeployment(ctx context.Context) error {
Expand Down