aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event/process.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-06-05 08:29:10 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2017-11-24 14:54:15 +0100
commit1ebc96fe10fbdbec22caa26d5d52a9f095da9687 (patch)
treef0a9170522cf2836cca741690cddf2cf8051ac4c /src/nvim/event/process.c
parent5215e3205a07b85e4e4cf1f8a8ca6be2b9556459 (diff)
downloadrneovim-1ebc96fe10fbdbec22caa26d5d52a9f095da9687.tar.gz
rneovim-1ebc96fe10fbdbec22caa26d5d52a9f095da9687.tar.bz2
rneovim-1ebc96fe10fbdbec22caa26d5d52a9f095da9687.zip
channels: allow bytes sockets and stdio, and buffered bytes output
Diffstat (limited to 'src/nvim/event/process.c')
-rw-r--r--src/nvim/event/process.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index 1bbe4d9cad..8946f049e2 100644
--- a/src/nvim/event/process.c
+++ b/src/nvim/event/process.c
@@ -92,7 +92,6 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
if (in) {
stream_init(NULL, &proc->in, -1,
STRUCT_CAST(uv_stream_t, &proc->in.uv.pipe));
- proc->in.events = proc->events;
proc->in.internal_data = proc;
proc->in.internal_close_cb = on_process_stream_close;
proc->refcount++;
@@ -101,7 +100,6 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
if (out) {
stream_init(NULL, &proc->out, -1,
STRUCT_CAST(uv_stream_t, &proc->out.uv.pipe));
- proc->out.events = proc->events;
proc->out.internal_data = proc;
proc->out.internal_close_cb = on_process_stream_close;
proc->refcount++;
@@ -110,7 +108,6 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
if (err) {
stream_init(NULL, &proc->err, -1,
STRUCT_CAST(uv_stream_t, &proc->err.uv.pipe));
- proc->err.events = proc->events;
proc->err.internal_data = proc;
proc->err.internal_close_cb = on_process_stream_close;
proc->refcount++;
@@ -382,15 +379,15 @@ static void flush_stream(Process *proc, Stream *stream)
// Poll for data and process the generated events.
loop_poll_events(proc->loop, 0);
- if (proc->events) {
- multiqueue_process_events(proc->events);
+ if (stream->events) {
+ multiqueue_process_events(stream->events);
}
// Stream can be closed if it is empty.
if (num_bytes == stream->num_bytes) {
- if (stream->read_cb) {
+ if (stream->read_cb && !stream->did_eof) {
// Stream callback could miss EOF handling if a child keeps the stream
- // open.
+ // open. But only send EOF if we haven't already.
stream->read_cb(stream, stream->buffer, 0, stream->cb_data, true);
}
break;