vcsh icon indicating copy to clipboard operation
vcsh copied to clipboard

More robust error handling, especially for hooks

Open ao2 opened this issue 7 years ago • 1 comments

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 #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 avatar May 07 '18 09:05 ao2

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

ao2 avatar May 07 '18 10:05 ao2