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

[DRAFT] lib: fix structuredclone error for process.env #45384

Closed

Conversation

MrJithil
Copy link
Member

@MrJithil MrJithil commented Nov 9, 2022

internal: fix structuredclone error for process.env

fixes #45380

@MrJithil MrJithil force-pushed the fix-45380-structuredClone-issues branch from 2bf611c to c782803 Compare November 9, 2022 03:10
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Nov 9, 2022
@MrJithil MrJithil force-pushed the fix-45380-structuredClone-issues branch from c782803 to c173165 Compare November 9, 2022 03:12
@KhafraDev
Copy link
Member

this pr will cause some valid cases to return the wrong values: arrays, strings, etc

@MrJithil MrJithil changed the title internal: fix structuredclone error for process.env [DRAFT] lib: fix structuredclone error for process.env Nov 9, 2022
@MrJithil MrJithil force-pushed the fix-45380-structuredClone-issues branch from c173165 to 145b0a0 Compare November 9, 2022 07:29
lib: fix structuredclone error for process.env
@MrJithil MrJithil force-pushed the fix-45380-structuredClone-issues branch from 145b0a0 to eeabc9c Compare November 9, 2022 12:41
@@ -20,6 +21,8 @@ function structuredClone(value, options = undefined) {
channel ??= new MessageChannel();
channel.port1.unref();
channel.port2.unref();
if (typeof value === 'object' && !ArrayIsArray(value))
value = { ...value };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work for special objects that are transferable, such as error objects

@MrJithil MrJithil closed this Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

structuredClone does not work on process.env
4 participants