fix: fix cd command in powershell

This commit is contained in:
purocean
2022-03-23 23:16:08 +08:00
parent ecbbf78ee8
commit 2cae2a44e5
+6 -1
View File
@@ -28,11 +28,16 @@ const transformCdCommand = (command: string) => {
return `cd '${path.replace(/'/g, '\\\'')}'`
}
const shell = getShell()
// transform path for WSL shell.
if (getShell().indexOf('wsl.exe') > -1) {
if (shell.endsWith('wsl.exe')) {
return `cd '${toWslPath(path).replace(/'/g, '\\\'')}'`
}
if (shell.endsWith('powershell.exe')) {
return `cd '${path}'\n`
}
// change dir for Windows.
return `cd /d "${path}"\r`
}