I have a pre-commit hook for my repository which runs some coding standard static analysis tooling, and if any errors are found prompts the user with a Y/n prompt asking if they would like to automatically fix the errors that were found. This works great on the console but it breaks in Sublime Merge (macOS build 2083). The error message is:
line 11: /dev/tty: Device not configured
Which is this line at the start of my script which is designed to redirect input by assigning standard input to the keyboard:
exec < /dev/tty
I worked around the issue by checking to see if TTY was available in my pre-commit script like so:
if tty >/dev/null 2>&1; then exec </dev/tty fi
This causes my pre-commit skip to not ask the user but take a default action. Ideally I’d like to have SM prompt me for the choice somehow… can SM work with pre-commit hooks that require input somehow?