Skip to content

Commit b44d7b3

Browse files
fix: Honour 'ctrl+c' in the UI progress model (#764)
Also, fixes a minor bug in deployment deletion
1 parent 4b7e980 commit b44d7b3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/kubectl-directpv/progress_model.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ func (m progressModel) Init() tea.Cmd {
8282

8383
func (m progressModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
8484
switch msg := msg.(type) {
85+
case tea.KeyMsg:
86+
if msg.String() == "ctrl+c" {
87+
return m, tea.Batch(tea.Sequence(finalPause(), tea.Quit))
88+
}
89+
return m, nil
8590
case tea.WindowSizeMsg:
8691
if m.model != nil {
8792
m.model.Width = msg.Width - padding*2 - 4

pkg/installer/deployment.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ func doDeleteDeployment(ctx context.Context, name string) error {
275275
return err
276276
}
277277

278-
return deploymentClient.Delete(ctx, name, metav1.DeleteOptions{})
278+
if err = deploymentClient.Delete(ctx, name, metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
279+
return err
280+
}
281+
282+
return nil
279283
}
280284

281285
func deleteDeployment(ctx context.Context) error {

0 commit comments

Comments
 (0)