From 54ceb3a0d0b6835cec58d6479d160c1ab76b44d3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 6 May 2014 19:39:24 +0100 Subject: [PATCH] Use fifo buffers for git-tools command output --- rc/git-tools.kak | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/rc/git-tools.kak b/rc/git-tools.kak index ec2d68f9..ae804d52 100644 --- a/rc/git-tools.kak +++ b/rc/git-tools.kak @@ -32,20 +32,15 @@ def -shell-params \ log) filetype=git-log ;; status) filetype=git-status ;; esac - tmpfile=$(mktemp /tmp/kak-git-XXXXXX) - if git "$@" > ${tmpfile}; then - [ -n "$kak_opt_docsclient" ] && echo "eval -client '$kak_opt_docsclient' %{" + output=$(mktemp -d -t kak-git.XXXXXXXX)/fifo + mkfifo ${output} + ( git "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null & - echo "edit! -scratch *git* - exec |cat${tmpfile}gk - nop %sh{rm ${tmpfile}} - set buffer filetype '${filetype}'" - - [ -n "$kak_opt_docsclient" ] && echo "}" - else - echo "echo %{git $@ failed, see *debug* buffer}" - rm ${tmpfile} - fi + echo "eval -try-client '$kak_opt_docsclient' %{ + edit! -fifo ${output} *git* + set buffer filetype '${filetype}' + hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } } + }" } run_git_blame() {