fortify/ldd/exec.go
Ophestra Umiker d41b9d2d9c
ldd: separate Parse from Exec and trim space
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-09 23:51:15 +09:00

19 lines
279 B
Go

package ldd
import (
"fmt"
"os"
"os/exec"
"strings"
)
func Exec(p string) ([]*Entry, error) {
t := exec.Command("ldd", p)
t.Stdout, t.Stderr = new(strings.Builder), os.Stderr
if err := t.Run(); err != nil {
return nil, err
}
return Parse(t.Stdout.(fmt.Stringer))
}