summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2015-07-25 06:01:24 -0700
committerAli Ijaz Sheikh <ofrobots@google.com>2015-07-27 17:14:08 -0700
commitab479659c789f938f0560b49167ba85ef825f1ba (patch)
tree375a06060997e56767abf5c6c353be39cb0a81bb /lib
parentc786d6341dba61980060281d4ae1a31d451f05c0 (diff)
downloadandroid-node-v8-ab479659c789f938f0560b49167ba85ef825f1ba.tar.gz
android-node-v8-ab479659c789f938f0560b49167ba85ef825f1ba.tar.bz2
android-node-v8-ab479659c789f938f0560b49167ba85ef825f1ba.zip
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/util.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/util.js b/lib/util.js
index 37f2a07ba2..136a66a6c1 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;