From 2cae2a44e5574b626c82800bca04eb667c37bd38 Mon Sep 17 00:00:00 2001 From: purocean Date: Wed, 23 Mar 2022 17:41:12 +0800 Subject: [PATCH] fix: fix cd command in powershell --- src/main/shell.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/shell.ts b/src/main/shell.ts index 56160600..abff58cf 100644 --- a/src/main/shell.ts +++ b/src/main/shell.ts @@ -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` }