Skip to content

fix: fall back to home dir when terminal cwd does not exist#128

Open
whitesockcat wants to merge 2 commits into
collabs-inc:mainfrom
whitesockcat:fix/pty-invalid-cwd-fallback
Open

fix: fall back to home dir when terminal cwd does not exist#128
whitesockcat wants to merge 2 commits into
collabs-inc:mainfrom
whitesockcat:fix/pty-invalid-cwd-fallback

Conversation

@whitesockcat

Copy link
Copy Markdown

Summary

  • Terminal tile crash fix: When a terminal tile remembers a remote/WSL cwd (e.g. /home/user/) that does not exist on the local macOS host, the spawned shell exits immediately, causing the tile to flash and disappear. Added fs.accessSync validation before spawning — falls back to os.homedir() when the path is inaccessible.
  • Sidebar shortcut change: Changed the sidebar-files toggle from Cmd+B to Cmd+Shift+B to avoid conflicts with common terminal keybindings (e.g. tmux prefix). Updated menu accelerator and tooltip to match. Cmd+\ remains as an alternative.

Test plan

  • Create two terminal tiles, one with a remote/WSL target so its cwd is a non-local path (e.g. /home/user/)
  • Close and reopen the app so the cwd is remembered
  • Create a third terminal tile — it should open in the home directory instead of crashing
  • Verify Cmd+Shift+B toggles the sidebar
  • Verify Cmd+\ still toggles the sidebar

🤖 Generated with Claude Code

@yiliush

yiliush commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

whitesockcat and others added 2 commits April 13, 2026 20:00
Cmd+B conflicts with common terminal keybindings (e.g. tmux prefix).
Change the sidebar-files toggle to Cmd+Shift+B and update the menu
accelerator and tooltip to match. Cmd+\ remains as an alternative.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a terminal tile remembers a remote/WSL cwd (e.g. /home/user/)
that does not exist on the local host, pty.spawn starts a shell in
a nonexistent directory causing it to exit immediately. The tile
then auto-closes via the pty:exit handler, appearing as a
flash-and-disappear to the user.

Validate the cwd with fs.accessSync before spawning and fall back
to os.homedir() when it is inaccessible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@whitesockcat
whitesockcat force-pushed the fix/pty-invalid-cwd-fallback branch from 2ffe291 to 53e9f40 Compare April 13, 2026 12:01
@whitesockcat

Copy link
Copy Markdown
Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

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.

2 participants