Fix exit after defer.

This commit is contained in:
Mariano Cano 2021-10-07 12:43:24 -07:00
parent 48549bf317
commit 205148ad1f
5 changed files with 24 additions and 6 deletions

View file

@ -131,7 +131,6 @@ func main() {
// Initialize windows terminal
ui.Init()
defer ui.Reset()
if u.Get("pin-value") == "" && u.Get("pin-source") == "" && c.Pin == "" {
pin, err := ui.PromptPassword("What is the PKCS#11 PIN?")
@ -205,6 +204,9 @@ func main() {
if err := createPKI(k, c); err != nil {
fatalClose(err, k)
}
// Reset windows terminal
ui.Reset()
}
func fatal(err error) {
@ -213,6 +215,7 @@ func fatal(err error) {
} else {
fmt.Fprintln(os.Stderr, err)
}
ui.Reset()
os.Exit(1)
}