diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2015-07-25 16:01:24 +0300 |
---|---|---|
committer | Ali Ijaz Sheikh <ofrobots@google.com> | 2015-07-28 03:14:08 +0300 |
commit | ab479659c789f938f0560b49167ba85ef825f1ba (patch) | |
tree | 375a06060997e56767abf5c6c353be39cb0a81bb | |
parent | c786d6341dba61980060281d4ae1a31d451f05c0 (diff) |
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>
-rw-r--r-- | lib/util.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/util.js b/lib/util.js index 37f2a07ba27..136a66a6c1c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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; |