Skip to content

Commit

Permalink
util: delay creation of debug context
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
ofrobots committed Jul 28, 2015
1 parent c786d63 commit ab47965
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ab47965

Please sign in to comment.