mirror of
https://github.com/containers/podman.git
synced 2025-10-25 10:16:43 +08:00
Add a function for check if command exist
Use this function to check if command exist before execute it in our test. Signed-off-by: Yiqiao Pu <ypu@redhat.com>
This commit is contained in:
@ -612,3 +612,13 @@ func WaitContainerReady(p *PodmanTest, id string, expStr string, timeout int, st
|
||||
s.WaitWithDefaultTimeout()
|
||||
}
|
||||
}
|
||||
|
||||
//IsCommandAvaible check if command exist
|
||||
func IsCommandAvailable(command string) bool {
|
||||
check := exec.Command("bash", "-c", strings.Join([]string{"command -v", command}, " "))
|
||||
err := check.Run()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user