mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
refact: refactored several strings.Trim calls to core.Trim
This commit is contained in:
parent
5189068cd3
commit
ca9f4f0945
10 changed files with 35 additions and 23 deletions
10
core/core.go
10
core/core.go
|
@ -9,6 +9,14 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func Trim(s string) string {
|
||||
return strings.Trim(s, "\r\n\t ")
|
||||
}
|
||||
|
||||
func TrimRight(s string) string {
|
||||
return strings.TrimRight(s, "\r\n\t ")
|
||||
}
|
||||
|
||||
func Exec(executable string, args []string) (string, error) {
|
||||
path, err := exec.LookPath(executable)
|
||||
if err != nil {
|
||||
|
@ -20,7 +28,7 @@ func Exec(executable string, args []string) (string, error) {
|
|||
fmt.Printf("ERROR: path=%s args=%s err=%s out='%s'\n", path, args, err, raw)
|
||||
return "", err
|
||||
} else {
|
||||
return strings.Trim(string(raw), "\r\n\t "), nil
|
||||
return Trim(string(raw)), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue