Skip to content

Commit

Permalink
Makes CommandContains regex by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler committed Jul 28, 2023
1 parent 62ffc8c commit b8c9812
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ func runCheck(cond cond) bool {
func (c cond) CommandContains() (bool, error) {
c.requireArgs("Cmd", "Value")
out, err := shellCommandOutput(c.Cmd)
return strings.Contains(strings.TrimSpace(out), c.Value), err
outTrim := strings.TrimSpace(out)
if err != nil {
return false, err
}
return regexp.Match(c.Value, []byte(outTrim))
}

// CommandOutput checks if a given shell command produces an exact output. This
Expand Down

1 comment on commit b8c9812

@safinsingh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update the corresponding documentation as well?

Please sign in to comment.