Skip to content

fs: handle cpSync directory iterator errors#63993

Open
starkmarkus wants to merge 1 commit into
nodejs:mainfrom
starkmarkus:fs-cp-sync-copydir-errors
Open

fs: handle cpSync directory iterator errors#63993
starkmarkus wants to merge 1 commit into
nodejs:mainfrom
starkmarkus:fs-cp-sync-copydir-errors

Conversation

@starkmarkus

Copy link
Copy Markdown

This fixes fs.cpSync so directory iteration and related filesystem checks in the recursive C++ fast path fail as normal JS errors instead of bubbling native exceptions.

The change switches the directory-copy path to non-throwing std::filesystem calls and converts failures with ThrowStdErrException. It also adds a regression test for a copied directory that becomes inaccessible during traversal.

Validation:

  • node -c test/parallel/test-fs-cp-sync-inaccessible-dir-error.js
  • git diff --check

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Jun 18, 2026
@starkmarkus starkmarkus marked this pull request as ready for review June 18, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants