diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index f5dbf0694e47c2..55163554825b08 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -102,9 +102,6 @@ bool os_env_exists(const char *name) assert(r != UV_EINVAL); if (r != 0 && r != UV_ENOENT && r != UV_ENOBUFS) { ELOG("uv_os_getenv(%s) failed: %d %s", name, r, uv_err_name(r)); -#ifdef WIN32 - return (r == UV_UNKNOWN); -#endif } return (r == 0 || r == UV_ENOBUFS); } diff --git a/test/functional/eval/environ_spec.lua b/test/functional/eval/environ_spec.lua index 4c2adcf1bfb401..84564d9f937258 100644 --- a/test/functional/eval/environ_spec.lua +++ b/test/functional/eval/environ_spec.lua @@ -3,6 +3,7 @@ local clear = helpers.clear local eq = helpers.eq local environ = helpers.funcs.environ local exists = helpers.funcs.exists +local iswin = helpers.iswin describe('environment variables', function() it('environ() handles empty env variable', function() @@ -11,8 +12,8 @@ describe('environment variables', function() eq(nil, environ()['DOES_NOT_EXIST']) end) it('exists() handles empty env variable', function() - clear({env={EMPTY_VAR=""}}) - eq(1, exists('$EMPTY_VAR')) + clear({env={EMPTY_VAR=""}}) -- Windows treats this as "undefined". + eq((iswin() and 0 or 1), exists('$EMPTY_VAR')) eq(0, exists('$DOES_NOT_EXIST')) end) end)