mirror of
https://github.com/FiloSottile/age.git
synced 2026-03-11 08:55:41 +00:00
plugin: fix Plugin.Confirm again
This commit is contained in:
parent
cc39b3b4e6
commit
bca79c42d2
1 changed files with 6 additions and 3 deletions
|
|
@ -451,6 +451,9 @@ func (p *Plugin) DisplayMessage(message string) error {
|
|||
if s.Type == "fail" {
|
||||
return fmt.Errorf("client failed to display message")
|
||||
}
|
||||
if err := expectStanzaWithNoBody(s, 0); err != nil {
|
||||
return p.fatalInteractf("%v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -474,6 +477,9 @@ func (p *Plugin) RequestValue(prompt string, secret bool) (string, error) {
|
|||
if s.Type == "fail" {
|
||||
return "", fmt.Errorf("client failed to request value")
|
||||
}
|
||||
if err := expectStanzaWithBody(s, 0); err != nil {
|
||||
return "", p.fatalInteractf("%v", err)
|
||||
}
|
||||
return string(s.Body), nil
|
||||
}
|
||||
|
||||
|
|
@ -571,9 +577,6 @@ func readOkOrFail(sr *format.StanzaReader) (*format.Stanza, error) {
|
|||
}
|
||||
return s, nil
|
||||
case "ok":
|
||||
if s.Body != nil {
|
||||
return nil, fmt.Errorf("ok stanza has %d bytes of body, want 0", len(s.Body))
|
||||
}
|
||||
return s, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("expected ok or fail stanza, got %q", s.Type)
|
||||
|
|
|
|||
Loading…
Reference in a new issue