Skip to content

Commit

Permalink
Merge neovim#5316
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk committed Sep 10, 2016
2 parents fe06e2a + f8a8a56 commit bccb49b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/nvim/eval.c
Expand Up @@ -21765,9 +21765,15 @@ static inline bool common_job_start(TerminalJobData *data, typval_T *rettv)
Process *proc = (Process *)&data->proc;
if (proc->type == kProcessTypePty && proc->detach) {
EMSG2(_(e_invarg2), "terminal/pty job cannot be detached");
xfree(data->proc.pty.term_name);
shell_free_argv(proc->argv);
free_term_job_data_event((void **)&data);
return false;
}

data->id = next_chan_id++;
pmap_put(uint64_t)(jobs, data->id, data);

data->refcount++;
char *cmd = xstrdup(proc->argv[0]);
if (!process_spawn(proc)) {
Expand All @@ -21782,7 +21788,6 @@ static inline bool common_job_start(TerminalJobData *data, typval_T *rettv)
}
xfree(cmd);

data->id = next_chan_id++;

if (data->rpc) {
// the rpc channel takes over the in and out streams
Expand All @@ -21799,7 +21804,6 @@ static inline bool common_job_start(TerminalJobData *data, typval_T *rettv)
rstream_init(proc->err, 0);
rstream_start(proc->err, on_job_stderr, data);
}
pmap_put(uint64_t)(jobs, data->id, data);
rettv->vval.v_number = data->id;
return true;
}
Expand All @@ -21821,6 +21825,7 @@ static inline void free_term_job_data_event(void **argv)
dict_unref(data->self);
}
queue_free(data->events);
pmap_del(uint64_t)(jobs, data->id);
xfree(data);
}

Expand Down Expand Up @@ -21927,7 +21932,6 @@ static void on_process_exit(Process *proc, int status, void *d)

process_job_event(data, data->on_exit, "exit", NULL, 0, status);

pmap_del(uint64_t)(jobs, data->id);
term_job_data_decref(data);
}

Expand Down

0 comments on commit bccb49b

Please sign in to comment.