diff --git a/create/create.go b/create/create.go index b0eacbd..a121892 100644 --- a/create/create.go +++ b/create/create.go @@ -218,11 +218,17 @@ func (w *waitStage) watch(ctx context.Context, client *api.Client) error { return nil } case <-ctx.Done(): - msg := "timeout waiting for %s" - w.spinner.StopFailMessage(format.ProgressMessagef("", msg, w.kind)) - _ = w.spinner.StopFail() + switch ctx.Err() { + case context.DeadlineExceeded: + msg := "timeout waiting for %s" + w.spinner.StopFailMessage(format.ProgressMessagef("", msg, w.kind)) + _ = w.spinner.StopFail() - return fmt.Errorf(msg, w.kind) + return fmt.Errorf(msg, w.kind) + case context.Canceled: + _ = w.spinner.StopFail() + return nil + } } } } diff --git a/delete/delete.go b/delete/delete.go index 7d819f1..f397c1b 100644 --- a/delete/delete.go +++ b/delete/delete.go @@ -147,11 +147,17 @@ func (d *deleter) waitForDeletion(ctx context.Context, client *api.Client) error return fmt.Errorf("unable to get %s %q: %w", d.kind, d.mg.GetName(), err) } case <-ctx.Done(): - msg := "timeout waiting for %s" - spinner.StopFailMessage(format.ProgressMessagef("", msg, d.kind)) - _ = spinner.StopFail() + switch ctx.Err() { + case context.DeadlineExceeded: + msg := "timeout waiting for %s" + spinner.StopFailMessage(format.ProgressMessagef("", msg, d.kind)) + _ = spinner.StopFail() - return fmt.Errorf("timeout waiting for %s", d.kind) + return fmt.Errorf(msg, d.kind) + case context.Canceled: + _ = spinner.StopFail() + return nil + } } } }