use_stdin
Note: With many commands or scripts having
use_stdin: true
, only one will receive the data. The others will have nothing. If you need to pass the data from stdin to every command or script, please, submit a feature request.
Pass the stdin from the OS to the command/script.
Example
Use this option for the pre-push
hook when you have a script that does while read ...
. Without this option lefthook will hang: lefthook uses pseudo TTY by default, and it doesn't close stdin when all data is read.
# .lefthook/pre-push/do-the-magic.sh
remote="$1"
url="$2"
while read local_ref local_oid remote_ref remote_oid; do
# ...
done
# lefthook.yml
pre-push:
scripts:
"do-the-magic.sh":
runner: bash
use_stdin: true