To: vim_dev@googlegroups.com Subject: Patch 8.2.0239 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0239 Problem: MS-Windows: 'env' job option does not override existing environment variables. (Tim Pope) Solution: Set the environment variables later. (Yasuhiro Matsumoto, closes #5485, closes #5608) Files: src/os_win32.c, src/testdir/test_channel.vim *** ../vim-8.2.0238/src/os_win32.c 2020-02-10 21:32:14.909427290 +0100 --- src/os_win32.c 2020-02-10 22:02:02.829602533 +0100 *************** *** 4948,4971 **** if (ga_grow(gap, 1) == FAIL) return; - if (base) - { - WCHAR *p = (WCHAR*) base; - - // for last \0 - if (ga_grow(gap, 1) == FAIL) - return; - - while (*p != 0 || *(p + 1) != 0) - { - if (ga_grow(gap, 1) == OK) - *((WCHAR*)gap->ga_data + gap->ga_len++) = *p; - p++; - } - FreeEnvironmentStrings(base); - *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; - } - if (env != NULL) { for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi) --- 4948,4953 ---- *************** *** 4997,5002 **** --- 4979,5002 ---- } } + if (base) + { + WCHAR *p = (WCHAR*) base; + + // for last \0 + if (ga_grow(gap, 1) == FAIL) + return; + + while (*p != 0 || *(p + 1) != 0) + { + if (ga_grow(gap, 1) == OK) + *((WCHAR*)gap->ga_data + gap->ga_len++) = *p; + p++; + } + FreeEnvironmentStrings(base); + *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; + } + # if defined(FEAT_CLIENTSERVER) || defined(FEAT_TERMINAL) { # ifdef FEAT_CLIENTSERVER *** ../vim-8.2.0238/src/testdir/test_channel.vim 2020-02-10 21:32:14.909427290 +0100 --- src/testdir/test_channel.vim 2020-02-10 22:02:02.829602533 +0100 *************** *** 2006,2008 **** --- 2006,2017 ---- sleep 10m call assert_equal(-1, job_info(g:job).exitval) endfunc + + func Test_issue_5485() + let $VAR1 = 'global' + let g:Ch_reply = "" + let l:job = job_start([&shell, &shellcmdflag, has('win32') ? 'echo %VAR1% %VAR2%' : 'echo $VAR1 $VAR2'], {'env': {'VAR1': 'local', 'VAR2': 'local'}, 'callback': 'Ch_handler'}) + let g:Ch_job = l:job + call WaitForAssert({-> assert_equal("local local", trim(g:Ch_reply))}) + unlet $VAR1 + endfunc *** ../vim-8.2.0238/src/version.c 2020-02-10 21:32:14.913427265 +0100 --- src/version.c 2020-02-10 22:04:36.901019092 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 239, /**/ -- hundred-and-one symptoms of being an internet addict: 52. You ask a plumber how much it would cost to replace the chair in front of your computer with a toilet. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///