From ad3894d0283531b7dad89bd04ad0a56778373f15 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 30 Nov 2016 20:00:32 +0000 Subject: [PATCH] win: map ERROR_ELEVATION_REQUIRED to UV_EACCES uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED (740) if attempting to run an application that requires elevation. Refs: https://github.com/nodejs/node/issues/9464 --- src/win/error.c | 1 + test/test-error.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/win/error.c b/src/win/error.c index c512f35af97..642d1112e11 100644 --- a/src/win/error.c +++ b/src/win/error.c @@ -71,6 +71,7 @@ int uv_translate_sys_error(int sys_errno) { switch (sys_errno) { case ERROR_NOACCESS: return UV_EACCES; case WSAEACCES: return UV_EACCES; + case ERROR_ELEVATION_REQUIRED: return UV_EACCES; case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE; case WSAEADDRINUSE: return UV_EADDRINUSE; case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL; diff --git a/test/test-error.c b/test/test-error.c index 4c4efa30cdd..ff53eb1d777 100644 --- a/test/test-error.c +++ b/test/test-error.c @@ -53,6 +53,7 @@ TEST_IMPL(error_message) { TEST_IMPL(sys_error) { #if defined(_WIN32) ASSERT(uv_translate_sys_error(ERROR_NOACCESS) == UV_EACCES); + ASSERT(uv_translate_sys_error(ERROR_ELEVATION_REQUIRED) == UV_EACCES); ASSERT(uv_translate_sys_error(WSAEADDRINUSE) == UV_EADDRINUSE); ASSERT(uv_translate_sys_error(ERROR_BAD_PIPE) == UV_EPIPE); #else