Skip to content
Permalink
Browse files

lib: add guard to originalConsole

Currently when building --without-ssl or --without-inspector there will
be an error when trying to set up the console in bootstrap_node.js:

Can't determine the arch of: 'out/Release/node'
bootstrap_node.js:276
      if (!globalConsole.hasOwnProperty(key))
                        ^

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at installInspectorConsole (bootstrap_node.js:276:25)
    at get (bootstrap_node.js:264:21)
    at evalScript (bootstrap_node.js:395:30)
    at startup (bootstrap_node.js:125:9)
    at bootstrap_node.js:537:3

I think this issue was introduced in commit
3f48ab3 ("inspector: do not add
'inspector' property").

This commit attempts to fix this.

PR-URL: #12881
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information...
danbev committed May 7, 2017
1 parent 6914aea commit 54d331895c721fa85dc0ee237a3bbc04da3a324d
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/internal/bootstrap_node.js
@@ -261,7 +261,9 @@
enumerable: true,
get: function() {
if (!console) {
console = installInspectorConsole(originalConsole);
console = originalConsole === undefined ?
NativeModule.require('console') :
installInspectorConsole(originalConsole);
}
return console;
}

0 comments on commit 54d3318

Please sign in to comment.
You can’t perform that action at this time.