You might want to `set -o pipefail` on your bash because a failing process does not stop things from getting piped:
`echo OK | false | echo OK2` --> this command returns zero exit code even though false does return non-zero exit code. If you do `set -o pipefail` entire pipe will fail with non-zero exit code (of `false`).