Skip to content
New issue

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

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

Already on GitHub? # to your account

More robust error handling, especially for hooks #251

Open
ao2 opened this issue May 7, 2018 · 1 comment
Open

More robust error handling, especially for hooks #251

ao2 opened this issue May 7, 2018 · 1 comment

Comments

@ao2
Copy link

ao2 commented May 7, 2018

I noticed that vcsh does not catch the hooks exit value. So it's not possible to stop vcsh if a hook fails.

For instance I would use that functionality if a pre-enter hook would fail to do some preparation work, to avoid entering the repository in that case.

Possible solutions, in order of preference:

  • Use set -e in vcsh and handle special cases when errors should really be ignored
  • catch the exit value explicitly in hook()
  • Source hooks as suggested in Source hooks instead of calling them? #68. However I'd advise against that: having hooks as child processes like it is now, allows to write them in any programming language.
@ao2
Copy link
Author

ao2 commented May 7, 2018

Ah, a workaround I found for my use case is to execute (pun intended) kill -- -$PPID in the hook.
Rather nasty.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant