Skip to content

fix(shell): read nushell wrapper temp files past a user open alias - #4865

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-4862
Nov 20, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-4862

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

A config.nu alias or custom command named open is in scope when Nushell parses the wrapper from vendor autoload, so the wrapper's open $cd_file --raw and open $stdout_file --raw ran the user's command instead of reading the files. With alias open = ^open (common on macOS), wt switch printed "Switched" and the shell stayed put. The wrapper now runs hide open at the top of its body. That restores the builtin for the wrapper only: the user's alias still applies outside it, and with no alias defined hide open is a no-op (checked on nu 0.117).

test_nu_wrapper_reads_survive_open_alias defines alias open = ^echo ALIASED before the wrapper, then runs wt switch --create and wt config show. Before the change it failed with Directory not found … 'ALIASED /tmp/tmp.… --raw' does not exist. It now passes, along with the other nu_wrapper tests and the init_nu snapshot, which picks up the new lines.

The rm cleanup got the same protection in #3730. The wrapper's other bare builtins (cd, mktemp, print) are unchanged.

Closes #4862 — automated triage

An alias or custom command named open in config.nu is in scope when
the vendor-autoload wrapper is parsed, so the wrapper's reads of its cd
and stdout files ran the user's command instead. On macOS, where
alias open = ^open is common, wt switch printed Switched and left the
shell where it was. The wrapper now hides open in its own body, which
restores the builtin there without touching the user's scope.

Closes #4862
@worktrunk-bot worktrunk-bot added the automated-fix Automated CI fix label Nov 20, 2026
@max-sixty
max-sixty merged commit 593360b into main Nov 20, 2026
36 of 45 checks passed
@max-sixty
max-sixty deleted the fix/issue-4862 branch November 20, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nushell wrapper reads its cd file with bare open, so a user open alias breaks wt switch

2 participants