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.
This commit is contained in:
throwawayaccount12345-1 2021-07-09 22:18:25 -03:00 committed by GitHub
parent c30a0e0ca2
commit 719b23c54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.
# 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 </dev/null