fix: detect timeout error and apply default option (#888)

This commit is contained in:
Miguel Ibars 2025-04-11 06:46:49 -07:00 committed by GitHub
commit e292bbf049
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
package confirm
import (
"context"
"fmt"
"os"
@ -46,7 +47,7 @@ func (o Options) Run() error {
tea.WithOutput(os.Stderr),
tea.WithContext(ctx),
).Run()
if err != nil {
if err != nil && ctx.Err() != context.DeadlineExceeded {
return fmt.Errorf("unable to confirm: %w", err)
}
m = tm.(model)