Mercurial > vim
diff src/channel.c @ 8502:ee5cb2e9ed5a v7.4.1541
commit https://github.com/vim/vim/commit/8950a563b306ce76f259573d91c2ddccdf52e32e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 12 15:22:55 2016 +0100
patch 7.4.1541
Problem: Missing job_info().
Solution: Implement it.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 12 Mar 2016 15:30:04 +0100 |
parents | 42277980a76d |
children | 13e5a1f02be4 |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -3725,6 +3725,40 @@ job_status(job_T *job) return result; } +/* + * Implementation of job_info(). + */ + void +job_info(job_T *job, dict_T *dict) +{ + dictitem_T *item; + varnumber_T nr; + + dict_add_nr_str(dict, "status", 0L, (char_u *)job_status(job)); + + item = dictitem_alloc((char_u *)"channel"); + if (item == NULL) + return; + item->di_tv.v_lock = 0; + item->di_tv.v_type = VAR_CHANNEL; + item->di_tv.vval.v_channel = job->jv_channel; + if (job->jv_channel != NULL) + ++job->jv_channel->ch_refcount; + if (dict_add(dict, item) == FAIL) + dictitem_free(item); + +#ifdef UNIX + nr = job->jv_pid; +#else + nr = job->jv_proc_info.dwProcessId; +#endif + dict_add_nr_str(dict, "process", nr, NULL); + + dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL); + dict_add_nr_str(dict, "exit-cb", 0L, job->jv_exit_cb); + dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit); +} + int job_stop(job_T *job, typval_T *argvars) {