use a 16K buffer when reading from fifo

This commit is contained in:
Maxime Coste 2013-02-28 18:51:11 +01:00
parent 26826b981d
commit 849f225e70

View File

@ -55,8 +55,9 @@ Buffer* open_fifo(const String& name , const String& filename, Context& context)
Buffer* buffer = new Buffer(name, Buffer::Flags::Fifo | Buffer::Flags::NoUndo);
auto watcher = new FDWatcher(fd, [buffer](FDWatcher& watcher) {
char data[4096];
ssize_t count = read(watcher.fd(), data, 4096);
constexpr size_t buffer_size = 1024 * 16;
char data[buffer_size];
ssize_t count = read(watcher.fd(), data, buffer_size);
buffer->insert(buffer->end()-1,
count > 0 ? String(data, data+count)
: "*** kak: fifo closed ***\n");