Pre-commit: fix bug with calling `which`

Apparently output redirection messes with the exit status.