diff options
author | James McCoy <jamessan@jamessan.com> | 2017-01-13 11:12:35 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-01-14 07:49:07 -0500 |
commit | bde9bedb0b3e83eb6dd52a5374cc02adabfc2783 (patch) | |
tree | 671dd2cfaa0c1429b57c7e0f5fd7b79a8da9c6e9 /src | |
parent | 58ba3bcbefcad43c7fb163cd54d9a4f6b98a7100 (diff) | |
download | rneovim-bde9bedb0b3e83eb6dd52a5374cc02adabfc2783.tar.gz rneovim-bde9bedb0b3e83eb6dd52a5374cc02adabfc2783.tar.bz2 rneovim-bde9bedb0b3e83eb6dd52a5374cc02adabfc2783.zip |
job: Consume content from rbuffer before invoking the callback again
While a job callback is active, it may be invoked again. Since the
data handled by the first invocation of the callback hasn't been marked
as consumed, the subsequent invocation will see the same data.
Reported-by: Daniel Hahler
Patch-by: oni-link
Closes #5889
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cdf60d9765..6688405860 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -23183,11 +23183,10 @@ static void on_job_output(Stream *stream, TerminalJobData *data, RBuffer *buf, terminal_receive(data->term, ptr, count); } + rbuffer_consumed(buf, count); if (callback->type != kCallbackNone) { process_job_event(data, callback, type, ptr, count, 0); } - - rbuffer_consumed(buf, count); } static void eval_job_process_exit_cb(Process *proc, int status, void *d) |