readpassword: check extpass return code

...and exit if it is not zero.
This commit is contained in:
Jakob Unterwurzacher 2016-10-16 16:44:27 +02:00
parent 540f125f18
commit b2d33028a6

View File

@ -98,7 +98,11 @@ func readPasswordExtpass(extpass string) string {
}
p := readLineUnbuffered(pipe)
pipe.Close()
cmd.Wait()
err = cmd.Wait()
if err != nil {
tlog.Fatal.Printf("extpass program returned an error: %v", err)
os.Exit(exitCode)
}
if len(p) == 0 {
tlog.Fatal.Println("extpass: password is empty")
os.Exit(exitCode)