mirror of
https://github.com/taigrr/systemctl.git
synced 2026-03-09 00:14:38 -07:00
check stderr before reporting back error 1
This commit is contained in:
13
util.go
13
util.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user