Darcs currently has code in Utils like this:
Execute $VISUAL (or vi).
If it fails, execute emacs.
If it fails, execute emacs -nw.
[...]
I think the intention is to run emacs if vi isn't found in the $PATH,
but this will also run emacs if vi crashes. In particular, this is
annoying in the following use case:
Trent sets $VISUAL to a bash script "twb-editor" that executes a
"good" editor based on what is found in $PATH when it runs.
Trent runs "darcs send -a --edit". As the editor is started,
Trent changes his mind and tries to cancel the send by typing ^C.
Depending on when this happens, twb-editor will exit with code 130
(from the script) or an exit code of 1 (from the editor it
executed).
Trent expects this to make "darcs send" abort, but instead it
causes emacs to start up (vi isn't installed). This is very
confusing, because Trent just quit Emacs!
On Debian, there is a script called "sensible-editor". It contains code like this:
Execute <first alternative>.
If it fails with exit code 126 or 127, execute <second alternative>.
If it fails with exit code 126 or 127, execute <third alternative>.
[...]
for ortryrunning to only try the right hand side if the left hand side
exited with code 126 or 127 -- at least on Debian systems.
|