Unverified Commit 17ffacc3 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #57805 from liggitt/test-grep-pipe-fix

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Avoid error on closed pipe fixes https://github.com/kubernetes/kubernetes/issues/57706 from @stevekuznetsov: > If you do `echo | grep -q`, `grep` will exit when it finds the first match > If the `echo` is still writing to stdout it fails because there's no reader on that pipe anymore > So we always use `grep -q <<<"${content}"` now > since that uses a FIFO ```release-note NONE ```
parents cbdfed1e 0d5b9dd3
......@@ -265,7 +265,7 @@ kube::test::if_has_string() {
local message=$1
local match=$2
if echo "$message" | grep -q "$match"; then
if grep -q "${match}" <<< "${message}"; then
echo "Successful"
echo "message:$message"
echo "has:$match"
......@@ -283,7 +283,7 @@ kube::test::if_has_not_string() {
local message=$1
local match=$2
if echo "$message" | grep -q "$match"; then
if grep -q "${match}" <<< "${message}"; then
echo "FAIL!"
echo "message:$message"
echo "has:$match"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment