Skip to content

docs(api): explain syncProcessCwd async contexts and within behavior - #1536

Open
Aryan9891 wants to merge 1 commit into
google:mainfrom
Aryan9891:fix/docs-within-syncprocesscwd-876
Open

Aryan9891 wants to merge 1 commit into
google:mainfrom
Aryan9891:fix/docs-within-syncprocesscwd-876

Conversation

@Aryan9891

Copy link
Copy Markdown

Problem

Issue #876 notes that \cd()\ modifies \process.cwd()\ globally across the entire process, while \within()\ restores only zx's internal $\ working directory context. Users relying on Node fs operations or relative paths inside separate callbacks can encounter unexpected directory state without realizing the difference.

Solution

Document the async context interaction between \within(), \cd(), and \syncProcessCwd(). Provide concrete code examples showing the default behavior vs the restored behavior with \syncProcessCwd()\ enabled, and guidance on using $.cwd\ for scoped zx directory changes.

Fixes #876.

Clarify how cd() inside within() modifies process.cwd() globally while
within() restores only the zx $ context, and provide code examples showing
both the default behavior and restored behavior when syncProcessCwd() is
enabled.

Fixes google#876.

Signed-off-by: Aryan Sachin <aryansachinixd@gmail.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading documentation

1 participant