I have a build script that executes a long command that produces lots of output which went like this:
./compile
In order to troubleshoot compilation performance, I want to use ts
(from moreutils) which prefixes each output line with a timestamp. So I updated my script like this:
bash -c "./compile | ts '[%Y-%m-%d %H:%M:%S]'"
This works, but now the exit value is always 0
, event when compile
fails (I think, because ts
exits without an error).
How can I update my script to return compile
's exit code while using ts
?