src: don't include a null character in the WriteConsoleW call
Fixes: https://github.com/nodejs/node/issues/7755 PR-URL: https://github.com/nodejs/node/pull/7764 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
f7a23a2d04
commit
09f861f231
@ -257,7 +257,10 @@ static void PrintErrorString(const char* format, ...) {
|
|||||||
|
|
||||||
std::vector<wchar_t> wbuf(n);
|
std::vector<wchar_t> wbuf(n);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, out.data(), -1, wbuf.data(), n);
|
MultiByteToWideChar(CP_UTF8, 0, out.data(), -1, wbuf.data(), n);
|
||||||
WriteConsoleW(stderr_handle, wbuf.data(), n, nullptr, nullptr);
|
|
||||||
|
// Don't include the null character in the output
|
||||||
|
CHECK_GT(n, 0);
|
||||||
|
WriteConsoleW(stderr_handle, wbuf.data(), n - 1, nullptr, nullptr);
|
||||||
#else
|
#else
|
||||||
vfprintf(stderr, format, ap);
|
vfprintf(stderr, format, ap);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user