diff --git a/src/espIdf/monitor/index.ts b/src/espIdf/monitor/index.ts index e803050c0..91c523533 100644 --- a/src/espIdf/monitor/index.ts +++ b/src/espIdf/monitor/index.ts @@ -46,6 +46,7 @@ export class IDFMonitor { IDFMonitor.config = config; } + static async start() { const modifiedEnv = await appendIdfAndToolsToPath(this.config.workspaceFolder); if (!IDFMonitor.terminal) { @@ -72,7 +73,7 @@ export class IDFMonitor { // Function to quote paths for PowerShell and correctly handle spaces for Bash const quotePath = (path) => { - if (shellType.includes("powershell")) { + if (shellType.includes("powershell") || shellType.includes("pwsh")) { return `'${path.replace(/'/g, "''")}'`; } else if (shellType.includes("cmd")) { return `"${path}"`; @@ -121,9 +122,11 @@ export class IDFMonitor { const envSetCmd = process.platform === "win32" ? "set" : "export"; const quotedIdfPath = quotePath(modifiedEnv.IDF_PATH); - if (shellType.includes("powershell")) { - this.terminal.sendText(`& ${envSetCmd} IDF_PATH=${quotedIdfPath}`); - this.terminal.sendText(`& ${args.join(" ")}`); + if (shellType.includes("powershell") || shellType.includes("pwsh")) { + this.terminal.sendText(`$env:IDF_PATH = ${quotedIdfPath};`); + // For pwsh users on Linux, we need to add delay between commands + await new Promise((resolve) => setTimeout(resolve, 1000)); + this.terminal.sendText(` & ${args.join(" ")}\r`); } else if (shellType.includes("cmd")) { this.terminal.sendText(`${envSetCmd} IDF_PATH=${modifiedEnv.IDF_PATH}`); this.terminal.sendText(args.join(" ")); diff --git a/src/utils.ts b/src/utils.ts index bd0edf8d4..95b69659d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1286,7 +1286,7 @@ export function getUserShell() { const shell = vscode.env.shell; // list of shells to check - const shells = ["powershell", "cmd", "bash", "zsh"]; + const shells = ["powershell", "cmd", "bash", "zsh", "pwsh"]; // if user's shell is in the list, return it for (let i = 0; i < shells.length; i++) {