From 719b23c54f1ed1ade7545ce8026d60b09792913d Mon Sep 17 00:00:00 2001 From: throwawayaccount12345-1 <77868642+throwawayaccount12345-1@users.noreply.github.com> Date: Fri, 9 Jul 2021 22:18:25 -0300 Subject: [PATCH] Fix #3957 If the session wasn't valid anymore by the time the linter finishes, writing to "$dir"/fifo would hang forever leaving temporary files in /tmp/kak-lint.XXX and the process alive. This commit fixes that by not writing to the fifo if the session was not valid. throwawayaccount12345-1 Copyright Waiver I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. --- rc/tools/lint.kak | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rc/tools/lint.kak b/rc/tools/lint.kak index 0d92b828..9996b0e8 100644 --- a/rc/tools/lint.kak +++ b/rc/tools/lint.kak @@ -209,11 +209,11 @@ define-command \ # A fifo to send the results back to a Kakoune buffer. mkfifo "$dir"/fifo - printf 'lint-open-output-buffer %s' "$(kakquote "$dir")" | kak -p "$kak_session" - - # We are done here. Send the results to Kakoune, - # and clean up. - cat "$dir"/result > "$dir"/fifo + # Send the results to kakoune if the session is still valid. + if printf 'lint-open-output-buffer %s' "$(kakquote "$dir")" | kak -p "$kak_session"; then + cat "$dir"/result > "$dir"/fifo + fi + # Clean up. rm -rf "$dir" } & ) >"$dir"/stderr 2>&1