mirror of
https://github.com/taigrr/systemctl.git
synced 2025-10-25 17:20:34 +08:00
preliminary version of enable complete
This commit is contained in:
10
util.go
10
util.go
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var systemctl string
|
||||
@@ -38,3 +39,12 @@ func execute(ctx context.Context, args []string) (string, string, int, error) {
|
||||
|
||||
return output, warnings, code, err
|
||||
}
|
||||
|
||||
func filterErr(stderr string) error {
|
||||
matched, _ := regexp.MatchString(`does not exist`, stderr)
|
||||
if matched {
|
||||
return ErrDoesNotExist
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user