Skip to content

Snapshotting is persisting the cwd #49675

Description

@arcanis

Version

v20.6.1

Platform

Darwin

Subsystem

snapshots

What steps will reproduce the bug?

Generate a snapshot of the given script, then run it from a different directory. The process.cwd() function will keep returning the cwd you had while building the snapshot.

const v8 = require(`v8`);

if (v8.startupSnapshot.isBuildingSnapshot()) {
    v8.startupSnapshot.setDeserializeMainFunction(() => {
        console.log(process.cwd());
    });
}

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

No response

What is the expected behavior? Why is that the expected behavior?

It should return the actual cwd.

What do you see instead?

It returns the cwd at the time of --build-snapshot.

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.snapshotIssues and PRs related to the startup snapshot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions