Skip to content

Commit

Permalink
refactor: checkIfResourceExists function
Browse files Browse the repository at this point in the history
  • Loading branch information
lizzy-0323 committed Nov 19, 2024
1 parent 92ca5d8 commit 675fbae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/cli/utils/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ func checkIfResourceExists(checkCmd string, resourceList ...string) bool {
cmd := exec.Command("sh", "-c", checkCmd)
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()

if err != nil {
if err := cmd.Run(); err != nil {
return false
}

output := out.Bytes()
for _, resource := range resourceList {
if !bytes.Contains(out.Bytes(), []byte(resource)) {
if !bytes.Contains(output, []byte(resource)) {
return false
}
}
Expand Down

0 comments on commit 675fbae

Please sign in to comment.