darcs

Issue 1465 ortryrunning should try RHS iff exit code is 126 or 127

Title ortryrunning should try RHS iff exit code is 126 or 127
Priority feature Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, twb
Assigned To
Topics

Created on 2009-05-17.12:58:29 by twb, last changed 2009-08-27.14:21:43 by admin.

Messages
msg7834 (view) Author: twb Date: 2009-05-17.12:58:27
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.
msg7856 (view) Author: twb Date: 2009-05-30.03:34:13
A related error: currently, the code will fall back on vi, then emacs, then nano...
*if* VISUAL isn't set.  If VISUAL is set, and it breaks, the fallback on vi is skipped,
and it goes straight on to trying Emacs!
msg7860 (view) Author: twb Date: 2009-05-30.15:35:16
The following patch updated the status of issue1465 to be resolved:

* Resolve issue1465: ortryrunning should check error code. 
Ignore-this: 5e991a70a7dae87e90c59e90459f4fa0
History
Date User Action Args
2009-05-17 12:58:30twbcreate
2009-05-30 03:34:16twbsetstatus: unread -> unknown
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7856
2009-05-30 15:35:19twbsetstatus: unknown -> resolved
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
messages: + msg7860
2009-08-10 02:08:26twbsetpriority: feature
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
2009-08-25 17:45:10adminsetnosy: + darcs-devel, - simon
2009-08-27 14:21:43adminsetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin