0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 8.0.0902: cannot specify directory or environment for a job

Problem:    Cannot specify directory or environment for a job.
Solution:   Add the "cwd" and "env" arguments to job options. (Yasuhiro
            Matsumoto, closes #1160)
This commit is contained in:
Bram Moolenaar
2017-08-11 19:12:11 +02:00
parent 76ca1b4041
commit 05aafed54b
9 changed files with 252 additions and 43 deletions

View File

@@ -4153,6 +4153,8 @@ free_job_options(jobopt_T *opt)
partial_unref(opt->jo_exit_partial);
else if (opt->jo_exit_cb != NULL)
func_unref(opt->jo_exit_cb);
if (opt->jo_env != NULL)
dict_unref(opt->jo_env);
}
/*
@@ -4433,6 +4435,26 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_term_finish = *val;
}
#endif
else if (STRCMP(hi->hi_key, "env") == 0)
{
if (!(supported & JO2_ENV))
break;
opt->jo_set |= JO2_ENV;
opt->jo_env = item->vval.v_dict;
++item->vval.v_dict->dv_refcount;
}
else if (STRCMP(hi->hi_key, "cwd") == 0)
{
if (!(supported & JO2_CWD))
break;
opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd))
{
EMSG2(_(e_invarg2), "cwd");
return FAIL;
}
opt->jo_set |= JO2_CWD;
}
else if (STRCMP(hi->hi_key, "waittime") == 0)
{
if (!(supported & JO_WAITTIME))