From aef0b48ef05b5980d2f3a1e4bc14b70d9688d59b Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Wed, 18 Aug 2010 23:19:24 +0100 Subject: [PATCH] git-gui: ensure correct application termination in git-gui--askpass With Tk 8.5 the askpass utility can hang waiting for the wish shell implicit event loop to exit. This patch uses an explicit event loop to ensure correct application termination. Reported-by: Anders Kaseorg Tested-by: Jonathan Nieder Signed-off-by: Pat Thoyts --- git-gui--askpass | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/git-gui--askpass b/git-gui--askpass index 12e117ecb1..4277f30c41 100755 --- a/git-gui--askpass +++ b/git-gui--askpass @@ -5,6 +5,8 @@ exec wish "$0" -- "$@" # This is a trivial implementation of an SSH_ASKPASS handler. # Git-gui uses this script if none are already configured. +package require Tk + set answer {} set yesno 0 set rc 255 @@ -30,16 +32,20 @@ if {!$yesno} { frame .b button .b.ok -text OK -command finish -button .b.cancel -text Cancel -command {destroy .} +button .b.cancel -text Cancel -command cancel pack .b.ok -side left -expand 1 pack .b.cancel -side right -expand 1 pack .b -side bottom -fill x -padx 10 -pady 10 bind . {focus -force .e} -bind . finish -bind . {destroy .} -bind . {exit $rc} +bind . [list .b.ok invoke] +bind . [list .b.cancel invoke] +bind . {set rc $rc} + +proc cancel {} { + set ::rc 255 +} proc finish {} { if {$::yesno} { @@ -50,10 +56,11 @@ proc finish {} { } } - set ::rc 0 puts $::answer - destroy . + set ::rc 0 } wm title . "OpenSSH" tk::PlaceWindow . +vwait rc +exit $rc -- 2.11.4.GIT