diff options
Diffstat (limited to 'lib/internal/process/execution.js')
-rw-r--r-- | lib/internal/process/execution.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index 5eda7541c8..227c1c2149 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -142,8 +142,12 @@ function createFatalException() { if (exceptionHandlerState.captureFn !== null) { exceptionHandlerState.captureFn(er); } else if (!process.emit('uncaughtException', er, type)) { - // If someone handled it, then great. otherwise, die in C++ land + // 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; @@ -157,6 +161,7 @@ function createFatalException() { const { kExpandStackSymbol } = require('internal/util'); if (typeof er[kExpandStackSymbol] === 'function') er[kExpandStackSymbol](); + er.stack = inspect(er, { colors }); } catch { // Nothing to be done about it at this point. } |