Default new panes to WSL home (~) instead of inherited Windows cwd
Previously: spawn_wsl(cwd=None) passed no --cd to wsl.exe, so each pane inherited the launcher's cwd — which is typically C:\Users\<user>, surfacing inside WSL as /mnt/c/Users/<user>. Annoying because the first thing you do in a new pane is `cd ~`. Now: if the caller didn't specify a cwd, we explicitly pass `--cd ~` so the pane lands in the WSL user's home. Existing panes keep their saved cwd from the workspace.json. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
94bdb884ad
commit
7d1f1f4b9a
1 changed files with 7 additions and 4 deletions
|
|
@ -67,10 +67,13 @@ impl PtyManager {
|
|||
cmd.arg("-d");
|
||||
cmd.arg(d);
|
||||
}
|
||||
if let Some(c) = cwd.as_deref() {
|
||||
cmd.arg("--cd");
|
||||
cmd.arg(c);
|
||||
}
|
||||
// Default new panes to the WSL user's home (~) rather than the
|
||||
// Windows-side cwd we inherit from the launcher (typically
|
||||
// C:\Users\<you>, which shows up as /mnt/c/Users/<you> inside WSL).
|
||||
// wsl.exe resolves `~` against the distro's default shell.
|
||||
let resolved_cwd = cwd.as_deref().unwrap_or("~");
|
||||
cmd.arg("--cd");
|
||||
cmd.arg(resolved_cwd);
|
||||
// Force a login shell so .bashrc etc. run and PATH is populated.
|
||||
// wsl.exe without an explicit command launches the default shell
|
||||
// interactively, which is exactly what we want.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue