diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-11-29 06:24:14 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-12-02 04:51:20 +0800 |
commit | edb8f228a27378e59aed3b9632895f8c13799863 (patch) | |
tree | d28fb1ac21d29c8a55005de0f6a960cd41a2821e /lib/inspector.js | |
parent | cfc2559ee0807e4c01ad882211792e917c6dba17 (diff) | |
download | android-node-v8-edb8f228a27378e59aed3b9632895f8c13799863.tar.gz android-node-v8-edb8f228a27378e59aed3b9632895f8c13799863.tar.bz2 android-node-v8-edb8f228a27378e59aed3b9632895f8c13799863.zip |
console: move the inspector console wrapping in a separate file
Move the wrapping of the inspector console in a separate file
for clarity. In addition, save the original console from the
VM explicitly via an exported property
`require('internal/console/inspector').consoleFromVM`
that `require('inspector').console` can alias to it later,
instead of hanging the original console onto `per_thread.js`
during bootstrap and counting on that `per_thread.js`
only gets evaluated once and gets cached.
PR-URL: https://github.com/nodejs/node/pull/24709
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/inspector.js')
-rw-r--r-- | lib/inspector.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/inspector.js b/lib/inspector.js index 6988eccf82..14ea01e6ad 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -12,7 +12,6 @@ const { const { validateString } = require('internal/validators'); const util = require('util'); const { Connection, open, url } = process.binding('inspector'); -const { originalConsole } = require('internal/process/per_thread'); if (!Connection) throw new ERR_INSPECTOR_NOT_AVAILABLE(); @@ -103,6 +102,8 @@ module.exports = { open: (port, host, wait) => open(port, host, !!wait), close: process._debugEnd, url: url, - console: originalConsole, + // This is dynamically added during bootstrap, + // where the console from the VM is still available + console: require('internal/console/inspector').consoleFromVM, Session }; |