Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_cp.js #24320

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_cp.js
  • Loading branch information
iuioiua committed Jun 23, 2024
commit 1f2c2b00ca56c91e4e15ae681dc5d2e6aff71563
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 { op_node_cp, op_node_cp_sync } from "ext:core/ops";

import { op_node_cp, op_node_cp_sync, primordials } 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
Loading