mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
job: Add a maxmem
parameter to job_start
The value is forwarded to it's own WStream instance
This commit is contained in:
parent
c722e22ee6
commit
0dea2682dc
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user