bug-ed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ed] git related bug when using ed as $EDITOR on OS X Mavericks


From: John Cowan
Subject: Re: [Bug-ed] git related bug when using ed as $EDITOR on OS X Mavericks & Yosemite
Date: Sat, 20 Dec 2014 14:25:20 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Steven Terpe scripsit:

> gnu-ed 1.10 crashes git commit editor on OS X (git version doesn’t
> seem to matter but can be duplicated using both Apple Git-50 (1.9.3)
> and compiling latest v2.2.1 git from source.

The problem is that git, like most source code control systems, interprets
any non-zero return from the user's editor as a commit failure.  
On the other hand, since ed is often used non-interactively, it's
important that it report any failure of a script through the exit
status, so that shell scripts can notice what's happened.

The best approach is to use this script as the value of $EDITOR:

#!/bin/sh
ed "$@"
exit 0

That forces the exit value always to be 0, no matter what happens inside
the editor.

-- 
John Cowan          http://www.ccil.org/~cowan        address@hidden
When I'm stuck in something boring where reading would be impossible or
rude, I often set up math problems for myself and solve them as a way
to pass the time.      --John Jenkins



reply via email to

[Prev in Thread] Current Thread [Next in Thread]