66// TODO(petamoriken): enable prefer-primordials for node polyfills
77// deno-lint-ignore-file prefer-primordials
88
9- import { internals } from "ext:core/mod.js" ;
9+ import { internals , primordials } from "ext:core/mod.js" ;
1010import {
1111 op_bootstrap_unstable_args ,
1212 op_node_child_ipc_pipe ,
@@ -37,16 +37,7 @@ import {
3737 ERR_OUT_OF_RANGE ,
3838 genericNodeError ,
3939} from "ext:deno_node/internal/errors.ts" ;
40- import {
41- ArrayIsArray ,
42- ArrayPrototypeJoin ,
43- ArrayPrototypePush ,
44- ArrayPrototypeSlice ,
45- ObjectAssign ,
46- StringPrototypeSlice ,
47- } from "ext:deno_node/internal/primordials.mjs" ;
4840import { getSystemErrorName , promisify } from "node:util" ;
49- import { createDeferredPromise } from "ext:deno_node/internal/util.mjs" ;
5041import process from "node:process" ;
5142import { Buffer } from "node:buffer" ;
5243import {
@@ -55,6 +46,16 @@ import {
5546} from "ext:deno_node/internal/util.mjs" ;
5647import { kNeedsNpmProcessState } from "ext:deno_process/40_process.js" ;
5748
49+ const {
50+ ArrayIsArray,
51+ ArrayPrototypeJoin,
52+ ArrayPrototypePush,
53+ ArrayPrototypeSlice,
54+ ObjectAssign,
55+ PromiseWithResolvers,
56+ StringPrototypeSlice,
57+ } = primordials ;
58+
5859const MAX_BUFFER = 1024 * 1024 ;
5960
6061type ForkOptions = ChildProcessOptions ;
@@ -345,11 +346,7 @@ type ExecExceptionForPromisify = ExecException & ExecOutputForPromisify;
345346
346347const customPromiseExecFunction = ( orig : typeof exec ) => {
347348 return ( ...args : [ command : string , options : ExecOptions ] ) => {
348- const { promise, resolve, reject } = createDeferredPromise ( ) as unknown as {
349- promise : PromiseWithChild < ExecOutputForPromisify > ;
350- resolve ?: ( value : ExecOutputForPromisify ) => void ;
351- reject ?: ( reason ?: ExecExceptionForPromisify ) => void ;
352- } ;
349+ const { promise, resolve, reject } = PromiseWithResolvers ( ) ;
353350
354351 promise . child = orig ( ...args , ( err , stdout , stderr ) => {
355352 if ( err !== null ) {
@@ -681,11 +678,7 @@ const customPromiseExecFileFunction = (
681678 options ?: ExecFileOptions ,
682679 ]
683680 ) => {
684- const { promise, resolve, reject } = createDeferredPromise ( ) as unknown as {
685- promise : PromiseWithChild < ExecOutputForPromisify > ;
686- resolve ?: ( value : ExecOutputForPromisify ) => void ;
687- reject ?: ( reason ?: ExecFileExceptionForPromisify ) => void ;
688- } ;
681+ const { promise, resolve, reject } = PromiseWithResolvers ( ) ;
689682
690683 promise . child = orig ( ...args , ( err , stdout , stderr ) => {
691684 if ( err !== null ) {
0 commit comments