wt: exec shell vs shell integration (opens in new tab)

Problem statement: my cd subcommand does not survive a terminal split — the new pane opens at the original directory, not the worktree. 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 (...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help