Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit d7ade3b

Browse files
committed
console: make global console work in workers
PR-URL: #109 Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Olivia Hugger <[email protected]> Reviewed-By: James Butler <[email protected]>
1 parent fe685fb commit d7ade3b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/console.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@ Console.prototype.groupEnd = function groupEnd() {
245245
this[kGroupIndent].slice(0, this[kGroupIndent].length - 2);
246246
};
247247

248-
module.exports = new Console(process.stdout, process.stderr);
248+
if (isMainThread) {
249+
module.exports = new Console(process.stdout, process.stderr);
250+
} else {
251+
const { SyncWriteStream } = require('internal/fs');
252+
module.exports = new Console(new SyncWriteStream(1), new SyncWriteStream(2));
253+
}
249254
module.exports.Console = Console;
250255

251256
function noop() {}

0 commit comments

Comments
 (0)