check exit code on pipe