vcsh
vcsh copied to clipboard
More robust error handling, especially for hooks
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 -ein vcsh and handle special cases when errors should really be ignored - catch the exit value explicitly in
hook() - Source hooks as suggested in #68. However I'd advise against that: having hooks as child processes like it is now, allows to write them in any programming language.
Ah, a workaround I found for my use case is to execute (pun intended) kill -- -$PPID in the hook.
Rather nasty.