From 920ee5c1ff83f7d1c0ebb9feaec9351a1d2faac6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 19 Jun 2019 12:48:44 +0200 Subject: [PATCH] process: disable coloring fatal error stack trace Fatal errors are logged from C++ directly to stderr. If colored stack trace is used, ANSI color escape sequences are literally included in the stack trace string. It works in console on Unix-like systems, but does not work on Windows or in inspector's DevTools. This PR disables colored stack trace for fatal errors. --- lib/internal/process/execution.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index 962bf0c8099210..8d1eeb20afcba8 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -151,9 +151,6 @@ function createOnGlobalUncaughtException() { // If someone handled it, then great. Otherwise, die in C++ land // since that means that we'll exit the process, emit the 'exit' event. const { inspect } = require('internal/util/inspect'); - const colors = internalBinding('util').guessHandleType(2) === 'TTY' && - require('internal/tty').hasColors() || - inspect.defaultOptions.colors; try { if (!process._exiting) { process._exiting = true; @@ -167,7 +164,7 @@ function createOnGlobalUncaughtException() { const { kExpandStackSymbol } = require('internal/util'); if (typeof er[kExpandStackSymbol] === 'function') er[kExpandStackSymbol](); - er.stack = inspect(er, { colors }); + er.stack = inspect(er); } catch { // Nothing to be done about it at this point. }