Skip to content

Different runtime behaviour of fs.realpath vs fs.promises.realpath is very confusing #37737

@bpasero

Description

@bpasero
  • Version: 12.18.3
  • Platform: macOS
  • Subsystem: ARM

What steps will reproduce the bug?

Have a project that was still using promisify(fs.realpath) and replace this with fs.promises.realpath to clean it up thinking the runtime behaviour will be the same. But in reality there is different behaviour: on Windows, subst drives will be resolved to their targets when realpath.native is used and left untouched with realpath.

How often does it reproduce? Is there a required condition?

Always when using subst drives on Windows. There are probably more differences.

What is the expected behavior?

That the fs API is in sync with the non promised variant. fs.promises.realpath should be a drop in replacement for promisify(fs.realpath) but not promisify(fs.realpath.native). There should be a fs.promises.realpath.native.

What do you see instead?

fs.promises.realpath behaves like promisify(fs.realpath.native)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions