mirror of
https://github.com/taigrr/systemctl.git
synced 2025-10-06 00:37:03 +08: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