Skip to content

Commit

Permalink
Add error handling to pass password-source
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Pichler committed Oct 3, 2019
1 parent 3c0a62e commit 3339303
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jiracli/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ func (o *GlobalOptions) GetPass() string {
cmd.Stderr = buf
if err := cmd.Run(); err == nil {
passwd = strings.TrimSpace(buf.String())
} else {
panic(err)
}
} else {
log.Warning("Pass binary was not found! Fallback to default password behaviour!")
}
} else if o.PasswordSource.Value == "stdin" {
allBytes, err := ioutil.ReadAll(os.Stdin)
Expand Down Expand Up @@ -188,6 +192,8 @@ func (o *GlobalOptions) SetPass(passwd string) error {
return fmt.Errorf("Failed to clear password for %s", passName)
}
}
} else {
return fmt.Errorf("Pass binary not found!")
}
} else if o.PasswordSource.Value != "" {
return fmt.Errorf("Unknown password-source: %s", o.PasswordSource)
Expand Down

0 comments on commit 3339303

Please sign in to comment.