diff options
-rw-r--r-- | src/nvim/eval.c | 1 | ||||
-rw-r--r-- | src/nvim/os/channel.c | 3 | ||||
-rw-r--r-- | src/nvim/os/job.c | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 3213e36f81..7300e60b1a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10474,6 +10474,7 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) on_job_stderr, on_job_exit, true, + 0, &rettv->vval.v_number); if (rettv->vval.v_number <= 0) { diff --git a/src/nvim/os/channel.c b/src/nvim/os/channel.c index 653f09756a..f859544663 100644 --- a/src/nvim/os/channel.c +++ b/src/nvim/os/channel.c @@ -80,6 +80,7 @@ bool channel_from_job(char **argv) job_err, job_exit, true, + 0, &status); if (status <= 0) { @@ -104,7 +105,7 @@ void channel_from_stream(uv_stream_t *stream) rstream_set_stream(channel->data.streams.read, stream); rstream_start(channel->data.streams.read); // write stream - channel->data.streams.write = wstream_new(1024 * 1024); + channel->data.streams.write = wstream_new(0); wstream_set_stream(channel->data.streams.write, stream); channel->data.streams.uv = stream; } diff --git a/src/nvim/os/job.c b/src/nvim/os/job.c index b369004e47..dcf50243a9 100644 --- a/src/nvim/os/job.c +++ b/src/nvim/os/job.c @@ -21,7 +21,6 @@ #define EXIT_TIMEOUT 25 #define MAX_RUNNING_JOBS 100 #define JOB_BUFFER_SIZE 1024 -#define JOB_WRITE_MAXMEM 1024 * 1024 struct job { // Job id the index in the job table plus one. @@ -131,6 +130,7 @@ void job_teardown() /// @param exit_cb Callback that will be invoked when the job exits /// @param defer If the job callbacks invocation should be deferred to vim /// main loop +/// @param maxmem Maximum amount of memory used by the job WStream /// @param[out] The job id if the job started successfully, 0 if the job table /// is full, -1 if the program could not be executed. /// @return The job pointer if the job started successfully, NULL otherwise @@ -140,6 +140,7 @@ Job *job_start(char **argv, rstream_cb stderr_cb, job_exit_cb job_exit_cb, bool defer, + size_t maxmem, int *status) { int i; @@ -210,7 +211,7 @@ Job *job_start(char **argv, handle_set_job((uv_handle_t *)&job->proc_stdout, job); handle_set_job((uv_handle_t *)&job->proc_stderr, job); - job->in = wstream_new(JOB_WRITE_MAXMEM); + job->in = wstream_new(maxmem); wstream_set_stream(job->in, (uv_stream_t *)&job->proc_stdin); // Start the readable streams job->out = rstream_new(read_cb, JOB_BUFFER_SIZE, job, defer); |