fix(ext/node): attach console stream properties (#25617)

`kBindStreamsLazy` should be called with `process` during init, but it
never was.
This commit is contained in:
snek 2024-09-13 17:28:35 -07:00 committed by GitHub
parent d162733db2
commit 2c0bf6fd65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

View File

@ -128,6 +128,7 @@ import internalTestBinding from "ext:deno_node/internal/test/binding.ts";
import internalTimers from "ext:deno_node/internal/timers.mjs";
import internalUtil from "ext:deno_node/internal/util.mjs";
import internalUtilInspect from "ext:deno_node/internal/util/inspect.mjs";
import internalConsole from "ext:deno_node/internal/console/constructor.mjs";
import net from "node:net";
import os from "node:os";
import pathPosix from "node:path/posix";
@ -198,6 +199,7 @@ function setupBuiltinModules() {
http2,
https,
inspector,
"internal/console/constructor": internalConsole,
"internal/child_process": internalCp,
"internal/crypto/certificate": internalCryptoCertificate,
"internal/crypto/cipher": internalCryptoCipher,

View File

@ -82,3 +82,8 @@ nodeGlobals.setImmediate = nativeModuleExports["timers"].setImmediate;
nodeGlobals.setInterval = nativeModuleExports["timers"].setInterval;
nodeGlobals.setTimeout = nativeModuleExports["timers"].setTimeout;
nodeGlobals.performance = nativeModuleExports["perf_hooks"].performance;
nativeModuleExports["internal/console/constructor"].bindStreamsLazy(
nativeModuleExports["console"],
nativeModuleExports["process"],
);

View File

@ -667,10 +667,15 @@ Console.prototype.dirxml = Console.prototype.log;
Console.prototype.error = Console.prototype.warn;
Console.prototype.groupCollapsed = Console.prototype.group;
export function bindStreamsLazy(console, object) {
Console.prototype[kBindStreamsLazy].call(console, object);
}
export { Console, formatTime, kBindProperties, kBindStreamsLazy };
export default {
Console,
kBindStreamsLazy,
kBindProperties,
formatTime,
bindStreamsLazy,
};