Skip to content

Commit

Permalink
cscli: when prompting, use default in case of EOF instead of going fo…
Browse files Browse the repository at this point in the history
…r "no" (crowdsecurity#3447)
  • Loading branch information
mmetc authored Feb 5, 2025
1 parent 362d5dc commit bf0a1cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/hubops/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package hubops

import (
"context"
"errors"
"fmt"
"io"
"os"
"slices"
"strings"
Expand Down Expand Up @@ -203,7 +205,11 @@ func (p *ActionPlan) Confirm(verbose bool) (bool, error) {
Default: true,
}

// in case of EOF, it's likely been closed by the package manager (freebsd?), ignore it
if err := survey.AskOne(prompt, &answer); err != nil {
if errors.Is(err, io.EOF) {
return prompt.Default, nil
}
return false, err
}

Expand Down

0 comments on commit bf0a1cc

Please sign in to comment.