Skip to content

errors: skip fatal error highlighting on windows

Rodrigo Muino Tomonari requested to merge github/fork/Hakerh400/tty into master

Some consoles do not convert ANSI escape sequences to colors, rather display them directly to the stdout. On those consoles, libuv emulates colors by intercepting stdout stream and calling corresponding Windows API functions for setting console colors. However, fatal error are handled differently and we cannot easily highlight them.

Fixes https://github.com/nodejs/node/issues/29387


According to this, Windows fully supports ANSI escapes starting from v.1607 ("Anniversery Update", OS build 14393), so we could add additional check:

if (process.platform === 'win32') {
  const ver = os.release().split('.').map(a => +a);
  if (ver[0] !== 10 || ver[2] < 14393) {
    return originalStack;
  }
}

but given that https://github.com/nodejs/node/issues/29387#issuecomment-620716360 uses build 17763, seems like that this test is not reliable.


Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading