diff --git a/src/espIdf/monitor/index.ts b/src/espIdf/monitor/index.ts index 4a78b784a..ce9c00333 100644 --- a/src/espIdf/monitor/index.ts +++ b/src/espIdf/monitor/index.ts @@ -45,7 +45,7 @@ export class IDFMonitor { this.config = config; } - start() { + async start() { const modifiedEnv = appendIdfAndToolsToPath(this.config.workspaceFolder); this.terminal = window.createTerminal({ name: `ESP-IDF Monitor ${this.config.wsPort ? "(--ws enabled)" : ""}`, @@ -114,14 +114,16 @@ export class IDFMonitor { const quotedIdfPath = quotePath(modifiedEnv.IDF_PATH); if (shellType.includes("powershell") || shellType.includes("pwsh")) { - this.terminal.sendText(`$env:IDF_PATH = ${quotedIdfPath}`, true); - this.terminal.sendText(`& ${args.join(" ")}`, true); + 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}`, true); - this.terminal.sendText(args.join(" "), true); + this.terminal.sendText(`${envSetCmd} IDF_PATH=${modifiedEnv.IDF_PATH}`); + this.terminal.sendText(args.join(" ")); } else { - this.terminal.sendText(`${envSetCmd} IDF_PATH=${quotedIdfPath}`, true); - this.terminal.sendText(args.join(" "), true); + this.terminal.sendText(`${envSetCmd} IDF_PATH=${quotedIdfPath}`); + this.terminal.sendText(args.join(" ")); } return this.terminal; diff --git a/src/extension.ts b/src/extension.ts index 10241e3fb..8244b5e8b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3967,7 +3967,7 @@ function createQemuMonitor( monitorTerminal.sendText(ESP.CTRL_RBRACKET); monitorTerminal.sendText(`exit`); } - monitorTerminal = idfMonitor.start(); + monitorTerminal = await idfMonitor.start(); }); } @@ -4159,7 +4159,7 @@ async function createIdfMonitor( monitorTerminal.sendText(ESP.CTRL_RBRACKET); monitorTerminal.sendText(`exit`); } - monitorTerminal = idfMonitor.start(); + monitorTerminal = await idfMonitor.start(); if (noReset) { const idfPath = idfConf.readParameter( "idf.espIdfPath",