fix: resolve drive-relative cd (cd d:) in cwd memory
path.isAbsolute('d:') is false on Windows, so a drive-relative cd resolved
against the current base, produced a nonexistent path, and the pane kept
its creation directory in the snapshot. Map a bare drive-letter argument
to the drive root (the fresh-shell answer; we cannot know the drive's
remembered directory).
This commit is contained in:
1 parent
9a330499de
commit
01827bf70b
1 file changed
+7
@@ -37,6 +37,13 @@ export function resolveCwd(current: string | undefined, rawArg: string): string
|
||||
}
|
||||
// `cd -` means the shell's previous directory, which we cannot know here.
|
||||
if (arg === '-') return null
|
||||
// Drive-relative `cd d:` (cmd/PowerShell): the target is the drive's
|
||||
// current directory, which the shell never tells us — path.isAbsolute('d:')
|
||||
// is false, so without this branch it resolves against the base and dies on
|
||||
// a nonexistent `<base>\d:`. The drive root is the fresh-shell answer.
|
||||
if (process.platform === 'win32' && /^[a-zA-Z]:$/.test(arg)) {
|
||||
return existingDir(`${arg.toUpperCase()}\\`)
|
||||
}
|
||||
|
||||
const base = current && current.trim() ? current : homedir()
|
||||
// An absolute argument wins; otherwise resolve against the base. Both forms
|
||||
|
||||
Reference in new issue
Block a user