From: Jonathan Nieder Date: Fri, 03 Dec 2010 09:14:09 GMT Subject: Re: [PATCH] Abort mergetool on read error from stdinput Message-ID: <20101203091409.GG18202@burratino> In-Reply-To: <70B726FD-EC6A-47B2-9AB1-1CDA3B19358A@dewire.com> Robin Rosenberg wrote: > Subject: [PATCH] Abort mergetool on read error from stdinput > > If the mergetool has not quit (by mistake like pressing > Command-W instead of Command-Q) and the user pressed Ctrl-C > in the shell that runs mergetool, bash goes into an infinite > look, at least on Mac OS X. Ctrl-C kills the diff program > but not the mergetool script. > > Signed-off-by: Robin Rosenberg > --- > git-mergetool--lib.sh | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh > index 77d4aee..1d1413d 100644 > --- a/git-mergetool--lib.sh > +++ b/git-mergetool--lib.sh > @@ -35,7 +35,7 @@ check_unchanged () { > while true; do > echo "$MERGED seems unchanged." > printf "Was the merge successful? [y/n] " > - read answer > + read answer || exit 1 > case "$answer" in > y*|Y*) status=0; break ;; > n*|N*) status=1; break ;; > Here is a better version and motivation. Thanks. For what it's worth, Acked-by: Jonathan Nieder