use a 16K buffer when reading from fifo
This commit is contained in:
parent
26826b981d
commit
849f225e70
|
@ -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);
|
Buffer* buffer = new Buffer(name, Buffer::Flags::Fifo | Buffer::Flags::NoUndo);
|
||||||
|
|
||||||
auto watcher = new FDWatcher(fd, [buffer](FDWatcher& watcher) {
|
auto watcher = new FDWatcher(fd, [buffer](FDWatcher& watcher) {
|
||||||
char data[4096];
|
constexpr size_t buffer_size = 1024 * 16;
|
||||||
ssize_t count = read(watcher.fd(), data, 4096);
|
char data[buffer_size];
|
||||||
|
ssize_t count = read(watcher.fd(), data, buffer_size);
|
||||||
buffer->insert(buffer->end()-1,
|
buffer->insert(buffer->end()-1,
|
||||||
count > 0 ? String(data, data+count)
|
count > 0 ? String(data, data+count)
|
||||||
: "*** kak: fifo closed ***\n");
|
: "*** kak: fifo closed ***\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user