mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
util: delay creation of debug context
We need the debug context to be able to inspect promises. However, this is very expensive and should not be done on default startup. PR-URL: https://github.com/nodejs/io.js/pull/2248 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Christopher Monsanto <chris@monsan.to> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
c786d6341d
commit
ab479659c7
@ -2,8 +2,8 @@
|
||||
|
||||
const uv = process.binding('uv');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
const Debug = require('vm').runInDebugContext('Debug');
|
||||
const internalUtil = require('internal/util');
|
||||
var Debug;
|
||||
|
||||
const formatRegExp = /%[sdj%]/g;
|
||||
exports.format = function(f) {
|
||||
@ -168,6 +168,7 @@ function arrayToHash(array) {
|
||||
|
||||
|
||||
function inspectPromise(p) {
|
||||
Debug = Debug || require('vm').runInDebugContext('Debug');
|
||||
var mirror = Debug.MakeMirror(p, true);
|
||||
if (!mirror.isPromise())
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user