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

Use eval instead of exec; Enable tty for the shell #94

Merged

Conversation

ssnickolay
Copy link
Contributor

@ssnickolay ssnickolay commented Dec 1, 2019

There are minor changes to support interactive pre-commit scripts.

` + autoInstall(hookName, fs) + "\n" + "cmd=\"lefthook run " + hookName + " $@\"" +
`

if lefthook >/dev/null 2>&1
then
exec $cmd
eval $cmd
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the reason of this change https://unix.stackexchange.com/a/296842

@@ -64,12 +64,15 @@ func addHook(hookName string, fs afero.Fs) {
if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

exec < /dev/tty # <- enables interactive shell
Copy link
Contributor Author

@ssnickolay ssnickolay Dec 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful if you run interactive scripts by pre-commit hook https://unix.stackexchange.com/a/91716

@ssnickolay ssnickolay marked this pull request as ready for review December 1, 2019 09:23
@Arkweid Arkweid merged commit 82db218 into evilmartians:master Dec 2, 2019
@perifer perifer mentioned this pull request Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants