Fix wrong use of `_log` function

We can not run `_log` in a pipe if we want to get the error code of the
piped command.