check stderr before reporting back error 1

This commit is contained in:
Tai Groot
2021-05-14 16:55:17 -07:00
parent 2517125d98
commit feff1f6edd
5 changed files with 68 additions and 12 deletions

13
util.go
View File

@@ -45,6 +45,19 @@ func filterErr(stderr string) error {
if matched {
return ErrDoesNotExist
}
matched, _ = regexp.MatchString(`Interactive authentication required`, stderr)
if matched {
return ErrInsufficientPermissions
}
matched, _ = regexp.MatchString(`Access denied`, stderr)
if matched {
return ErrInsufficientPermissions
}
matched, _ = regexp.MatchString(`Failed`, stderr)
if matched {
return ErrUnspecified
}
return nil
}