Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for interactive git hooks? #82512

janosh opened this issue Oct 14, 2019 · 1 comment

Support for interactive git hooks? #82512

janosh opened this issue Oct 14, 2019 · 1 comment


Copy link

@janosh janosh commented Oct 14, 2019

I wrote a global git hook for spell checking commit messages. It displays to the user a list of possible spelling mistakes (if any) and prompts to either abort the commit and modify the message or proceed anyway.

Everything works as expected on the command line. But using VS Code's built-in source control UI, I get the error /dev/tty: Device not configured.

Any way for VS Code to support interactive git hooks?

Global commit-msg hook


if ! command -v aspell &>/dev/null; then
  printf "%s\n" "[commit-msg hook] Warning: 'aspell' not installed. Unable to spell check commit message."
  wordList=( $(grep -v "^  " "$1" | aspell list) )

if (( "${#wordList[@]}" > 0 )); then
  printf "%s\n" "[commit-msg hook] Possible spelling errors found in commit message:" "${wordList[@]}"

exec < /dev/tty

while true; do
  read -p "[commit-msg hook] Proceed anyway? (y/n) " yn
  if [ "$yn" = "" ]; then
  case $yn in
      [Yy] ) break;;
      [Nn] ) exit 1;;
      * ) echo "Please answer y for yes or n for no.";;
Copy link

@joaomoreno joaomoreno commented Oct 15, 2019

Very likely there won't be any support more than the current API. You can add some way to call back to an extension running in VSCode which would show up some UI for the user to interact with.

@joaomoreno joaomoreno closed this Oct 15, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants