Skip to content

πŸ› fix: update runs from $HOME, so a deleted cwd no longer breaks it - #87

Merged
hadees merged 1 commit into
mainfrom
fix/update-missing-cwd
Sep 25, 2026
Merged

hadees merged 1 commit into
mainfrom
fix/update-missing-cwd

Conversation

@hadees

@hadees hadees commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Problem

Running update from a removed worktree: brew refuses (The current working directory must exist), npm dies in uv_cwd, uv and gem update in getcwd. Separately, asdf shims resolve node/ruby from the cwd's .tool-versions, so update inside a project upgraded that project's toolchain, not the global one.

Fix

  • update() warns on stderr when its cwd no longer exists, runs every step from $HOME, and restores the caller's directory (or leaves the shell in $HOME if it is gone).
  • Body wrapped in { } always { }; replaces the EXIT trap, so the sudo keepalive is also killed on ^C (the trap never fired there).
  • tests/update.bats: stubbed brew/npm/uv/gem/sudo; live cwd, deleted cwd, refused sudo. Mutation-checked.
  • CLAUDE.md Package lists note.

πŸ€– Generated with Claude Code

Typed in a removed worktree, every tool update() starts inherits the dead
cwd and dies on its own getcwd check (brew, npm, uv, gem). Typed inside a
project, asdf shims pick that project's node/ruby instead of the global
ones. update() now warns when its cwd is gone, runs from $HOME, and puts
the shell back in an always block β€” which also kills the sudo keepalive
on ^C, where the old EXIT trap never fired.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hadees
hadees merged commit c3e1717 into main Sep 25, 2026
5 checks passed
@hadees
hadees deleted the fix/update-missing-cwd branch September 25, 2026 20:51
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.

1 participant