From 78b80aafa7114b01d3e0459685cb7e8f9376d3f6 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Tue, 24 Dec 2013 16:40:16 -0800 Subject: [PATCH] ssh-askpass-darwin: account for newer versions of Mac OS X The osascript snippet we use to prompt the user for their password has different output on Mac OS X 10.9 Mavericks (and possibly others). The output can start with either: "button returned:OK, " or "text returned:". We were only accounting for the latter form. Account for the new-style output with an additional sed expression. Signed-off-by: David Aguilar --- share/git-cola/bin/ssh-askpass-darwin | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/share/git-cola/bin/ssh-askpass-darwin b/share/git-cola/bin/ssh-askpass-darwin index 8336581f..9de1a3a0 100755 --- a/share/git-cola/bin/ssh-askpass-darwin +++ b/share/git-cola/bin/ssh-askpass-darwin @@ -22,10 +22,15 @@ result=$(osascript \ -e "$DIALOG" \ -e 'end tell' 2>/dev/null) -if test -z "$result"; then - exit 1 -else - echo "$result" | - sed -e 's/^text returned://' -e 's/, button returned:.*$//' - exit 0 +if test -z "$result" +then + exit 1 fi + +# The beginning of the output can be either "text returned:" +# or "button returned:", and is Mac OS X version-dependent. +# Account for both output styles. +printf '%s\n' "$result" | +sed -e 's/^text returned://' -e 's/, button returned:.*$//' \ + -e 's/^button returned:OK, text returned://' +exit 0 -- 2.11.4.GIT