mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: added better debug logging for core.Exec (fixes #1125)
This commit is contained in:
parent
97b4dcb46e
commit
5bc9dd9259
3 changed files with 26 additions and 8 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"os/exec"
|
||||
"sort"
|
||||
|
||||
"github.com/bettercap/bettercap/v2/log"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
)
|
||||
|
||||
|
@ -36,10 +37,13 @@ func HasBinary(executable string) bool {
|
|||
func Exec(executable string, args []string) (string, error) {
|
||||
path, err := exec.LookPath(executable)
|
||||
if err != nil {
|
||||
log.Warning("executable %s not found in $PATH", executable)
|
||||
return "", err
|
||||
}
|
||||
|
||||
raw, err := exec.Command(path, args...).CombinedOutput()
|
||||
|
||||
log.Debug("exec=%s args=%v ret_err=%v ret_out=%s", path, args, err, string(raw))
|
||||
if err != nil {
|
||||
return str.Trim(string(raw)), err
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue