summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-11 19:12:11 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-11 19:12:11 +0200
commit05aafed54b50b602315ae55d83a7d089804cecb0 (patch)
tree5ba15103a30540de184b50ca8d82a7adaa2efd4d /src/channel.c
parent76ca1b4041db71df899a40d2ab1701af4f19cb2a (diff)
downloadvim-05aafed54b50b602315ae55d83a7d089804cecb0.zip
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)
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/channel.c b/src/channel.c
index 7eb6ce73e..3126cbd78 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -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))