Kill the blame back-end on window close.

Currently 'git-gui blame' does not kill its back-end
process, hoping that it will die anyway when the pipe
is closed. However, in some cases the process works
for a long time without producing any output. This
behavior results in a runaway CPU hog.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Alexander Gavrilov
2008-07-17 00:48:08 +04:00
committed by Shawn O. Pearce
parent 57cae87b77
commit e6131d30c2
2 changed files with 26 additions and 4 deletions

View File

@ -497,6 +497,20 @@ proc githook_read {hook_name args} {
return {}
}
proc kill_file_process {fd} {
set process [pid $fd]
catch {
if {[is_Windows]} {
# Use a Cygwin-specific flag to allow killing
# native Windows processes
exec kill -f $process
} else {
exec kill $process
}
}
}
proc sq {value} {
regsub -all ' $value "'\\''" value
return "'$value'"