I am running some unit tests which involve piping into my executable, like this.
cat text.txt | my_exe --options
Running these commands, how do I get the return value of my_exe
? Even when my_exe
returns failure, the return value is discarded. I assume the return value of cat
is prioritized instead.
Asked another way, how do I execute the above pipe command to give the same return value as :
cat text.txt && my_exe --options
ty!
edit : Using the traditional cmd
.
cmd
. @harrymc Unit tests are ran on a CI server, which notifies of failure of the command if return value != 0.