Previously. Problem statement: my wt tool’s cd subcommand does not survive a terminal split — the new pane opens at the original directory, not the worktree. worktrunk’s wt does(!) A subprocess cannot change its parent’s working directory (PWD). wt.sh works around it by replacing the script process with a fresh shell: cd "$target_path" || exit 1 exec "$SHELL" The exec "$SHELL" is the culprit. The interactive shell process is gone, replaced by a new one rooted in the worktree. The terminal emulator’s record of “what shell is (currently) running in this pane” still points to the original PID’s cwd at split time — not the new shell’s. Shell history, env vars, pushd/popd stack, prompt state: all lost too (not that I particularly care about all these). worktrunk ships a shell integration step: % wt config shell install That installs a function in ~/.bashrc / ~/.zshrc (or equivalent for other shells) which evals the binary’s output in the current shell. The cd happens in the shell we are…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.