From 8eec9c7d5b398918609d8edfed3928e873fa646f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 10 Sep 2020 07:15:32 -0400 Subject: Common handling of required/ignored env vars When starting a pty job, there are certain env vars that we need to either add or remove. Currently, there are two relevant scenarios. * Removing irrelevant env vars on Unix, mostly related to the terminal hosting nvim since they do not apply to a libvterm-hosted terminal. * Adding required env vars for Windows jobs. --- src/nvim/event/libuv_process.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 72e45878f6..0b1ecb12e2 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -83,6 +83,9 @@ int libuv_process_spawn(LibuvProcess *uvproc) int status; if ((status = uv_spawn(&proc->loop->uv, &uvproc->uv, &uvproc->uvopts))) { ELOG("uv_spawn failed: %s", uv_strerror(status)); + if (uvproc->uvopts.env) { + os_free_fullenv(uvproc->uvopts.env); + } return status; } @@ -102,6 +105,10 @@ static void close_cb(uv_handle_t *handle) if (proc->internal_close_cb) { proc->internal_close_cb(proc); } + LibuvProcess *uvproc = (LibuvProcess *)proc; + if (uvproc->uvopts.env) { + os_free_fullenv(uvproc->uvopts.env); + } } static void exit_cb(uv_process_t *handle, int64_t status, int term_signal) -- cgit