From b8c9812d796bbf1a100525da0e696af5ef9b36ea Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 27 Jul 2023 23:41:09 -0400 Subject: [PATCH] Makes CommandContains regex by default --- checks.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checks.go b/checks.go index 593d94f7..dc233eff 100644 --- a/checks.go +++ b/checks.go @@ -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