pre-commit script with interactive: true
unable to capture user input from console/tty
#709
-
I have a simple script that I want to run as a pre-commit hook. It checks if the user is on the Anyway, I've set I'm using lefthook
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@marques-work , this config should work: pre-commit:
scripts:
check-branch.sh:
runner: bash
use_stdin: true
interactive: true And no tweak with /dev/tty is required in the script itself. For example, I could make it work with the following script: read -r -p '[y/N]' answer
if [ "$answer" = "y" ]; then
echo 'YES'
exit 0
else
echo 'NO'
exit 1
fi I think it is kind of confusing that both Please write back if you get any problems with the configuration. |
Beta Was this translation helpful? Give feedback.
-
Update 3: tried with a fresh EC2 ( Same result (hangs forever): EC2 is using bash |
Beta Was this translation helpful? Give feedback.
Please, check the new 1.6.12 version of lefthook.