diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-07-18 15:13:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 15:13:17 +0200 |
commit | 7e1218cd8f9856319e2c86e761e869ef48bf9c5f (patch) | |
tree | 331c0b36e44cfd0c60ee270b2bd34a1faa2e08c7 /ext/node | |
parent | 8a48fcc9d3ee83ef2a02fe3db056f16a1276c540 (diff) |
fix(node): add process.dlopen API (#19860)
Fixes https://github.com/denoland/deno/issues/19830
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/process.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 5c4720a8f..b0a4d04c8 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -8,6 +8,7 @@ const internals = globalThis.__bootstrap.internals; const { core } = globalThis.__bootstrap; import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; import { EventEmitter } from "node:events"; +import Module from "node:module"; import { validateString } from "ext:deno_node/internal/validators.mjs"; import { ERR_INVALID_ARG_TYPE, @@ -291,6 +292,15 @@ function _kill(pid: number, sig: number): number { } } +// TODO(bartlomieju): flags is currently not supported. +export function dlopen(module, filename, flags) { + if (typeof flags !== "undefined") { + warnNotImplemented("process.dlopen doesn't support 'flags' argument"); + } + Module._extensions[".node"](module, filename); + return module; +} + export function kill(pid: number, sig: string | number = "SIGTERM") { if (pid != (pid | 0)) { throw new ERR_INVALID_ARG_TYPE("pid", "number", pid); @@ -403,6 +413,8 @@ class Process extends EventEmitter { /** https://nodejs.org/api/process.html#process_process_nexttick_callback_args */ nextTick = _nextTick; + dlopen = dlopen; + /** https://nodejs.org/api/process.html#process_process_events */ override on(event: "exit", listener: (code: number) => void): this; override on( |