Skip to content

Fix WSL shell profile support#17

Merged
abasiri merged 2 commits intodoctly:mainfrom
sunnydark:bugfix/wsl-shell-profile
Mar 24, 2026
Merged

Fix WSL shell profile support#17
abasiri merged 2 commits intodoctly:mainfrom
sunnydark:bugfix/wsl-shell-profile

Conversation

@sunnydark
Copy link
Contributor

Summary

Fixes WSL shell profile issues introduced in the shell profiles feature (#13):

  • Path translation — Windows paths (e.g. C:\Users\alexh\source\repos\project) are now converted to WSL mount paths (/mnt/c/Users/alexh/source/repos/project) via --cd flag passed to wsl.exe
  • Array mutation bugshellExtraArgs was mutating the cached profile's args array in place, causing --cd flags to accumulate across session launches. Fixed by copying the array on each use.
  • Claude session fallback — WSL profiles now automatically fall back to the auto-detected Windows shell for Claude sessions, since Claude CLI session data lives on the Windows filesystem and isn't accessible from inside WSL. WSL profiles continue to work for plain terminal sessions.

Changes

File What changed
main.js Added windowsToWslPath() and isWslShell() helpers; WSL --cd path conversion; spread-copy shellProfile.args to prevent mutation; Claude sessions fall back to Windows shell when WSL profile is active

Test plan

  • Select a WSL profile in settings → open a plain Terminal → verify it opens in WSL in the correct /mnt/c/... directory
  • With WSL profile selected → open a Claude session → verify it falls back to the Windows shell and works normally
  • Open multiple terminal sessions in sequence → verify no --cd arg accumulation (check logs)
  • Switch back to a non-WSL profile → verify everything still works

🤖 Generated with Claude Code

sunnydark and others added 2 commits March 23, 2026 13:15
WSL sessions need the project path translated from Windows format
(C:\Users\...) to WSL mount format (/mnt/c/Users/...). Pass the
converted path via --cd to wsl.exe and use the Windows home dir
as the spawn cwd (since wsl.exe itself is a Windows process).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix array mutation bug where shellExtraArgs accumulated --cd flags
  across sessions (copy array instead of mutating cached profile)
- Convert Windows paths to WSL /mnt/ format via --cd flag
- Fall back to auto-detected Windows shell for Claude sessions when
  a WSL profile is selected, since Claude CLI session data lives on
  the Windows filesystem and isn't accessible from inside WSL
- WSL profiles now work correctly for plain terminal sessions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abasiri abasiri merged commit aafdd76 into doctly:main Mar 24, 2026
3 checks passed
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