From 05b4d95a56b07d9d5ed966a6ffa8ae4abfa4cf71 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 28 Jun 2015 11:06:19 +0100 Subject: [PATCH] Run BufReadFifo hook after reading from fifo --- README.asciidoc | 3 +++ src/buffer_utils.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/README.asciidoc b/README.asciidoc index 822fb008..f76330b4 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1100,6 +1100,9 @@ existing hooks are: * `BufWritePost`: Executed just after a buffer is written, filename is used for filtering. * `BufClose`: Executed when a buffer is deleted, while it is still valid. + * `BufOpenFifo`: Executed when a buffer opens a fifo. + * `BufReadFifo`: Executed after some data has been red from a fifo and + inserted in the buffer. * `BufCloseFifo`: Executed when a fifo buffer closes its fifo file descriptor either because the buffer is being deleted, or because the writing end has been closed. diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index d208386e..9f8f8860 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -155,6 +155,8 @@ Buffer* create_fifo_buffer(String name, int fd, bool scroll) while (--loops and count > 0 and select(fifo+1, &rfds, nullptr, nullptr, &tv) == 1); + buffer->run_hook_in_own_context("BufReadFifo", buffer->name()); + if (count <= 0) buffer->values().erase(fifo_watcher_id); // will delete this }), std::move(watcher_deleter));