summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/child_process.ts
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-01-11 07:37:25 +0900
committerGitHub <noreply@github.com>2024-01-10 15:37:25 -0700
commit515a34b4de222e35c7ade1b92614d746e73d4c2e (patch)
tree8284201fc826a33f12597959a8a8be14e0f524bd /ext/node/polyfills/child_process.ts
parentd4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff)
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/node/polyfills/child_process.ts')
-rw-r--r--ext/node/polyfills/child_process.ts19
1 files changed, 11 insertions, 8 deletions
diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts
index ac3a0043f..0f45230d9 100644
--- a/ext/node/polyfills/child_process.ts
+++ b/ext/node/polyfills/child_process.ts
@@ -6,6 +6,14 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
+import { core, internals } from "ext:core/mod.js";
+const {
+ op_node_child_ipc_pipe,
+} = core.ensureFastOps();
+const {
+ op_npm_process_state,
+} = core.ensureFastOps(true);
+
import {
ChildProcess,
ChildProcessOptions,
@@ -48,9 +56,6 @@ import {
kEmptyObject,
} from "ext:deno_node/internal/util.mjs";
-const { core } = globalThis.__bootstrap;
-const ops = core.ops;
-
const MAX_BUFFER = 1024 * 1024;
type ForkOptions = ChildProcessOptions;
@@ -151,8 +156,7 @@ export function fork(
options.shell = false;
Object.assign(options.env ??= {}, {
- DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE: core.ops
- .op_npm_process_state(),
+ DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE: op_npm_process_state(),
});
return spawn(options.execPath, args, options);
@@ -824,13 +828,12 @@ export function execFileSync(
}
function setupChildProcessIpcChannel() {
- const fd = ops.op_node_child_ipc_pipe();
+ const fd = op_node_child_ipc_pipe();
if (typeof fd != "number" || fd < 0) return;
setupChannel(process, fd);
}
-globalThis.__bootstrap.internals.__setupChildProcessIpcChannel =
- setupChildProcessIpcChannel;
+internals.__setupChildProcessIpcChannel = setupChildProcessIpcChannel;
export default {
fork,