Skip to content

Commit

Permalink
lib: make sure console is writable
Browse files Browse the repository at this point in the history
The code currently assumes that `console` is already writable, but
that's only if it was previously defined as writable. If it hasn't
already been defined then the default value is false.

Refs: #17708

PR-URL: #20185
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
kfarnung authored and MylesBorins committed May 4, 2018
1 parent bd2e521 commit 9eacd66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@
Object.defineProperty(global, 'console', {
configurable: true,
enumerable: false,
value: wrappedConsole
value: wrappedConsole,
writable: true
});
setupInspector(originalConsole, wrappedConsole, CJSModule);
}
Expand Down

0 comments on commit 9eacd66

Please sign in to comment.