cz-cli icon indicating copy to clipboard operation
cz-cli copied to clipboard

/dev/tty: command not found

Open alireza0sfr opened this issue 3 years ago • 2 comments

Hello, I added "exec < /dev/tty && node_modules/.bin/cz --hook || true" to prepare-commit-msg hook and checked git commit and everything works fine. but when I want to use commitizen vscode extension I get "/dev/tty: command not found" error

alireza0sfr avatar May 07 '22 08:05 alireza0sfr

Also happens from VSCode when you try to make a commit from the source control functionality

jonastg avatar Nov 15 '24 11:11 jonastg

Following this SO question y modified prepare-commit-hook to:

tty="$(readlink /proc/$$/fd/2)"; [ "$tty" = "/dev/pts/1" ] && (exec < /dev/tty && node_modules/.bin/cz --hook) || true

And the result is:

  • git commit from terminal works as expected.
  • Commit form VSCode (manual message):
    • With message test, it fails. :point_right: ok
    • With message feat: test, it works! :point_right: ok

I don't know if it will work with other action (like cherry pick, etc) but it's better than nothing :grimacing:

jonastg avatar Nov 15 '24 12:11 jonastg