set the pipefail option, otherwise `foo | tee`'s status code will be 0 (success) even if foo failed
set the pipefail option, otherwise `foo | tee`'s status code will be 0 (success) even if foo failed

accordingly, must use bash instead of the default sh

yihui/crandalf,yihui/crandalf