I'd like to check whether a line printed by a command contains an error message, but I'd like to also print all the output from the command (for
make logs). Is there some way to get all the output of a command (unmodified) and an exit code based on the contents of that output? The closest workaround I could think about was
my_command | grep -C 99999999 '^Error'.
This is similar but distinct to this question, since I care about the exit code and don't want colouring.