Node: Windows REPL resets text color to white after output instead of resetting to the previous foreground color (e.g. grey)

Created on 3 Jun 2017  路  5Comments  路  Source: nodejs/node

  • Version: v8.0.0, v7.10.0, v7.9.0 (does not affect Boron v6.10.3)
  • Platform: Windows 10 x64 Build 10.0.15063
  • Subsystem: REPL

After the REPL displays some output to the console, it resets the text color to white instead of the previous foreground color.

Easiest to show with a picture comparing Boron (v6.10.3) to affected versions:

image

libuv tty windows

Most helpful comment

Yea this looks like this is just due to us missing that one code. I'll try and get to implementing it this week,
it doesn't seem all that complicated...

See here for more discussion, and links to other related conversations:
https://github.com/Microsoft/BashOnWindows/issues/2174

All 5 comments

fwiw, it's not happening on windows 7 here (tested with both node 7.7.2 and 8.0.0)

Sometime between 6.10.3 and 7.10.0, Node.js upgraded to a libuv version that uses ANSI codes under Windows 10 (instead of emulating them using Windows-specific calls). That's why this issue doesn't affect Windows 7. See https://github.com/libuv/libuv/pull/889.

The problem is that Windows 10 support for ANSI code seems to be incomplete. Here's the string that is printed when REPL outputs null:

'\u001b[1mnull\u001b[22m'

While "22" is listed in Wikipedia as "Normal color or intensity", it's not listed in MSDN.

Pinging @miniksa since you offered help with the libuv PR. Is my observation correct? Is it planned to add support for the '22' escape code in the future? If not, which escape code would you suggest using to revert boldness?

I'm pretty sure my co-worker @zadjii-msft was looking at 22m on Friday for an unrelated reason. I'll let him fill in the details.

Yea this looks like this is just due to us missing that one code. I'll try and get to implementing it this week,
it doesn't seem all that complicated...

See here for more discussion, and links to other related conversations:
https://github.com/Microsoft/BashOnWindows/issues/2174

Not a node.js bug then. I'll close this out.

Was this page helpful?
0 / 5 - 0 ratings