diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-04-19 18:02:57 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2026-04-20 02:31:09 +0200 |
| commit | 754232386529d031f3925007ead3e84a03fa6404 (patch) | |
| tree | 42383476c51c6764883847fe7f5832249f8b295b /src | |
| parent | a38451be40ca571e9c55656b19ea8926d5f4524b (diff) | |
fix(jobstart): use uv_os_environ directly
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/eval/funcs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index a2d8ed8bc2..01fa462256 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3382,13 +3382,14 @@ dict_T *create_environment(const dictitem_T *job_env, const bool clear_env, cons dict_T *env = tv_dict_alloc(); if (!clear_env) { - typval_T temp_env = TV_INITIAL_VALUE; - typval_T no_args[] = { { .v_type = VAR_UNKNOWN } }; - nlua_call_vimfn("vim._core.vimfn", "f_environ", no_args, &temp_env); - if (temp_env.v_type == VAR_DICT) { - tv_dict_extend(env, temp_env.vval.v_dict, "force"); + uv_env_item_t *envitems; + int envcount; + if (uv_os_environ(&envitems, &envcount) == 0) { + for (int i = 0; i < envcount; i++) { + tv_dict_add_str(env, envitems[i].name, strlen(envitems[i].name), envitems[i].value); + } + uv_os_free_environ(envitems, envcount); } - tv_clear(&temp_env); if (pty) { // These env vars shouldn't propagate to the child process. #6764 |
