Skip to content

hook: clear stale exit-dir state#2855

Open
sweenu wants to merge 1 commit into
cachix:mainfrom
sweenu:fix/stale-hook-exit-dir-cleanup
Open

hook: clear stale exit-dir state#2855
sweenu wants to merge 1 commit into
cachix:mainfrom
sweenu:fix/stale-hook-exit-dir-cleanup

Conversation

@sweenu
Copy link
Copy Markdown

@sweenu sweenu commented May 20, 2026

Disclaimer: PR made with Claude and reviewed by me

Problem

Exiting the devenv shell was cding me into a "random" directory, which was in fact the directory in .devenv/exit-dir that hadn't gotten cleanup correctly because my rm command in fish is an alias to echo "Stop using rm, put in the trash".

Summary of changes

  • bypass shell-level rm overrides when the shell hooks clean up .devenv/exit-dir
  • clear any leftover .devenv/exit-dir before launching a new shell, so a failed cleanup cannot redirect a later shell exit to an old path
  • add a bash/fish regression test for stale exit-dir cleanup and align the nushell hook with the same cleanup strategy

Test plan

  • devenv shell -- cargo fmt --check
  • devenv shell -- cargo nextest run -p devenv --test hook_outer_shell_survives

Bypass shell-level rm overrides when cleaning .devenv/exit-dir.
Also drop leftover exit-dir files before launching a new shell so a
failed cleanup cannot redirect the next shell exit to an old path.

Amp-Thread-ID: https://ampcode.com/threads/T-019e45b1-4096-72dd-8db0-1aafe8bcfa67
Co-authored-by: Amp <amp@ampcode.com>
@sweenu sweenu marked this pull request as ready for review May 21, 2026 10:09
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