mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
win/os_env_exists(): workaround libuv bug #10734
os_env_exists() fails on MSVC build: os_env_exists:104: uv_os_getenv(EMPTY_VAR) failed: -4094 UNKNOWN - Revert396a3945c4
- HACK: Windows: return TRUE if uv_os_getenv() returns UV_UNKNOWN, until libuv bug is fixed: https://github.com/libuv/libuv/issues/2413 ref396a3945c4 (r34642361)
This commit is contained in:
@@ -102,6 +102,9 @@ bool os_env_exists(const char *name)
|
|||||||
assert(r != UV_EINVAL);
|
assert(r != UV_EINVAL);
|
||||||
if (r != 0 && r != UV_ENOENT && r != UV_ENOBUFS) {
|
if (r != 0 && r != UV_ENOENT && r != UV_ENOBUFS) {
|
||||||
ELOG("uv_os_getenv(%s) failed: %d %s", name, r, uv_err_name(r));
|
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);
|
return (r == 0 || r == UV_ENOBUFS);
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,6 @@ local clear = helpers.clear
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local environ = helpers.funcs.environ
|
local environ = helpers.funcs.environ
|
||||||
local exists = helpers.funcs.exists
|
local exists = helpers.funcs.exists
|
||||||
local iswin = helpers.iswin
|
|
||||||
|
|
||||||
describe('environment variables', function()
|
describe('environment variables', function()
|
||||||
it('environ() handles empty env variable', function()
|
it('environ() handles empty env variable', function()
|
||||||
@@ -12,8 +11,8 @@ describe('environment variables', function()
|
|||||||
eq(nil, environ()['DOES_NOT_EXIST'])
|
eq(nil, environ()['DOES_NOT_EXIST'])
|
||||||
end)
|
end)
|
||||||
it('exists() handles empty env variable', function()
|
it('exists() handles empty env variable', function()
|
||||||
clear({env={EMPTY_VAR=""}}) -- Windows treats this as "undefined".
|
clear({env={EMPTY_VAR=""}})
|
||||||
eq((iswin() and 0 or 1), exists('$EMPTY_VAR'))
|
eq(1, exists('$EMPTY_VAR'))
|
||||||
eq(0, exists('$DOES_NOT_EXIST'))
|
eq(0, exists('$DOES_NOT_EXIST'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user