node -p process.verions display issue on Windows Cmd

Created on 22 May 2019  路  12Comments  路  Source: nodejs/node

{
node: '12.3.0',
v8: '7.4.288.27-node.17',
uv: '1.28.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '72',
nghttp2: '1.38.0',
napi: '4',
llhttp: '1.1.3',
http_parser: '2.8.0',
openssl: '1.1.1b',
cldr: '35.1',
icu: '64.2',
tz: '2019a',
unicode: '12.1'
}

confirmed-bug console windows

Most helpful comment

yes:
image

All 12 comments

Can reproduce for v12.3.0 on Windows 7 x64 with cmd.exe. Output in the REPL is OK.

12.2.0 also fails but 12.1.0 is okay.

{
  node: '12.2.0',
  v8: '7.4.288.21-node.17',
  uv: '1.28.0',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.38.0',
  napi: '4',
  llhttp: '1.1.3',
  http_parser: '2.8.0',
  openssl: '1.1.1b',
  cldr: '35.1',
  icu: '64.2',
  tz: '2019a',
  unicode: '12.1'
}
{
  node: '12.1.0',
  v8: '7.4.288.21-node.16',
  uv: '1.28.0',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.38.0',
  napi: '4',
  llhttp: '1.1.1',
  http_parser: '2.8.0',
  openssl: '1.1.1b',
  cldr: '35.1',
  icu: '64.2',
  tz: '2019a',
  unicode: '12.1'
}

I had a look at the changelog and I can't find anything obvious. Could someone verify that https://github.com/nodejs/node/commit/c2a03d58c3 has no impact? It seems the only entry that might have caused this? Otherwise it's probably best to bisected the commit.

Latest nightly from master also fails:

{
  node: '13.0.0-nightly2019052247c5c3da86',
  v8: '7.4.288.27-node.17',
  uv: '1.29.1',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.38.0',
  napi: '4',
  llhttp: '1.1.3',
  http_parser: '2.8.0',
  openssl: '1.1.1b',
  cldr: '35.1',
  icu: '64.2',
  tz: '2019a',
  unicode: '12.1'
}

Reverting 2b24ffae22 on master restores the expected behaviour. I'll open a revert PR.

Can someone check if process._rawDebug(message) has the same effect in Windows CMD?

Do you actually see colors in the original version of node -p?

yes:
image

@targos

Thanks. It seems we have to use uv_write for TTY on Windows so that libuv converts the color codes for us. I won't be near a Windows machine anytime soon, so I guess we could leave the patch reverted for now (or unless someone is willing to pick it up).

we have to use uv_write for TTY on Windows so that libuv converts the color codes for us

That is exactly what is happening, ANSI codes are emulated on Windows with WinApi calls.

@targos

Thanks. It seems we have to use uv_write for TTY on Windows so that libuv converts the color codes for us. I won't be near a Windows machine anytime soon, so I guess we could leave the patch reverted for now (or unless someone is willing to pick it up).

I've submitted an alternative to the full revert that falls back to console.log() for TTY on Windows: https://github.com/nodejs/node/pull/27829

Was this page helpful?
0 / 5 - 0 ratings