diff --git a/src/build/buildTask.ts b/src/build/buildTask.ts index 08de60d7d..88e0ab587 100644 --- a/src/build/buildTask.ts +++ b/src/build/buildTask.ts @@ -65,6 +65,7 @@ export class BuildTask { } this.building(true); const modifiedEnv = appendIdfAndToolsToPath(); + await ensureDir(this.curWorkspace); const canAccessCMake = await isBinInPath( "cmake", this.curWorkspace, @@ -75,10 +76,9 @@ export class BuildTask { this.curWorkspace, modifiedEnv ); - if (canAccessCMake === "" && canAccessNinja === "") { + if (canAccessCMake === "" || canAccessNinja === "") { throw new Error("CMake or Ninja executables not found"); } - await ensureDir(this.curWorkspace); const options: SpawnOptions = { cwd: this.curWorkspace, env: modifiedEnv, diff --git a/src/espIdfCustomTerminal.ts b/src/espIdfCustomTerminal.ts index d8e247336..ec65dede8 100644 --- a/src/espIdfCustomTerminal.ts +++ b/src/espIdfCustomTerminal.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import { ChildProcess, spawn, SpawnOptions } from "child_process"; import { Logger } from "./logger/logger"; +import { EOL } from "os"; export default class EspIdfCustomTerminal implements vscode.Pseudoterminal { private writeEmitter = new vscode.EventEmitter(); @@ -43,7 +44,9 @@ export default class EspIdfCustomTerminal implements vscode.Pseudoterminal { } formatText(text: string) { - return `\r${text.split(/(\r?\n)/g).join("\r")}\r`; + return process.platform === "win32" + ? `${text.split(/\r?\n/g).join(EOL)}` + : `\r${text.split(/(\r?\n)/g).join("\r")}\r`; } async handleInput(input: string) { @@ -131,6 +134,7 @@ export default class EspIdfCustomTerminal implements vscode.Pseudoterminal { `ESP-IDF Terminal process ended with exit code ${code}.` ); Logger.error(error.message, new Error(error.message)); + this.closeEmitter.fire(code); } this.addNewLine(); this.childProcess = undefined;