Skip to content

Commit

Permalink
fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_cp.js (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored and sbmsr committed Jul 2, 2024
1 parent c2f7186 commit a7944c7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ext/node/polyfills/_fs/_fs_cp.js
Original file line number Diff line number Diff line change
@@ -1,15 1,14 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

// deno-lint-ignore-file prefer-primordials

import { primordials } from "ext:core/mod.js";
import { op_node_cp, op_node_cp_sync } from "ext:core/ops";

import {
getValidatedPath,
validateCpOptions,
} from "ext:deno_node/internal/fs/utils.mjs";
import { promisify } from "ext:deno_node/internal/util.mjs";

const { PromisePrototypeThen } = primordials;

export function cpSync(src, dest, options) {
validateCpOptions(options);
const srcPath = getValidatedPath(src, "src");
Expand All @@ -27,10 26,11 @@ export function cp(src, dest, options, callback) {
const srcPath = getValidatedPath(src, "src");
const destPath = getValidatedPath(dest, "dest");

op_node_cp(
srcPath,
destPath,
).then(
PromisePrototypeThen(
op_node_cp(
srcPath,
destPath,
),
(res) => callback(null, res),
(err) => callback(err, null),
);
Expand Down

0 comments on commit a7944c7

Please sign in to comment.