Fix linkmode for static binaries
The actual output of ldd is in the error which caused static binaries to
return the wrong linkmode.
@@ -166,14 +166,12 @@ func getLinkmode() string {
return fmt.Sprintf("unknown: %v", err)
}
- output, err := utils.ExecCmd("ldd", abspath)
- if err != nil {
- return fmt.Sprintf("unknown: %v", err)
- }
-
- if strings.Contains(output, "not a dynamic executable") {
+ if _, err := utils.ExecCmd("ldd", abspath); err != nil {
+ if strings.Contains(err.Error(), "not a dynamic executable") {
return "static"
}
+ return fmt.Sprintf("unknown: %v", err)
+ }
return "dynamic"
}
