Skip to content

Commit b9e5854

Browse files
committed
pkg/util: don't version nonexisting programs
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
1 parent 2c0d67b commit b9e5854

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/util/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func queryPackageVersion(cmdArg ...string) string {
5656
// Note: This function is copied from containers/podman libpod/util.go
5757
// Please see https://github.com/containers/common/pull/1460
5858
func PackageVersion(program string) string { // program is full path
59+
_, err := os.Stat(program)
60+
if err != nil {
61+
return UnknownPackage
62+
}
5963
packagers := [][]string{
6064
{"/usr/bin/rpm", "-q", "-f"},
6165
{"/usr/bin/dlocate", "-F"}, // Debian, Ubuntu (quick)

0 commit comments

Comments
 (0)