Skip to content

fix(interpreter): seed cd dash from OLDPWD exec option#292

Open
skovranek wants to merge 1 commit into
vercel-labs:mainfrom
skovranek:fix-cd-dash-oldpwd
Open

fix(interpreter): seed cd dash from OLDPWD exec option#292
skovranek wants to merge 1 commit into
vercel-labs:mainfrom
skovranek:fix-cd-dash-oldpwd

Conversation

@skovranek

Copy link
Copy Markdown

Summary

  • seed the per-exec interpreter previousDir from OLDPWD when callers pass an env snapshot into exec()
  • add regression coverage for cd - across isolated exec() calls using persisted cwd and env

Why

exec() supports per-call cwd and env, which lets callers preserve shell state between isolated executions. cd updates OLDPWD in the returned env, but cd - reads the interpreter's internal previousDir state instead.

That means a caller can pass the returned PWD and OLDPWD into the next exec() call and still get stale cd - behavior.

Verification

  • pnpm --filter just-bash test:run src/Bash.exec-options.test.ts src/interpreter/builtins/cd.test.ts
  • pnpm --filter just-bash test:run src/spec-tests/bash/spec.test.ts -t 'cd - without OLDPWD'
  • pnpm lint
  • pnpm knip
  • pnpm --filter just-bash typecheck
  • pnpm --filter just-bash build

@skovranek skovranek requested a review from cramforce as a code owner July 8, 2026 21:26
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@skovranek is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@cramforce

Copy link
Copy Markdown
Contributor

Please sign your commit

@skovranek

Copy link
Copy Markdown
Author

Please sign your commit

@cramforce Thank you, it's verified now.

I hadn't added the key to GH for signing so it couldn't verify the sig.

Ref for others:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account?tool=cli

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.

2 participants