From 4a644bd45ee33185592b7bd472cbfa6979b61571 Mon Sep 17 00:00:00 2001 From: Brian Ignacio Date: Thu, 14 Jan 2021 19:31:22 +0800 Subject: [PATCH 1/2] fix code emitter output parsing --- src/build/buildTask.ts | 4 ++-- src/espIdfCustomTerminal.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) 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..18d286141 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; From 8dfbadd4595bd27877dba32ab1ac2565d8924b75 Mon Sep 17 00:00:00 2001 From: "brian@espressif.com" Date: Tue, 19 Jan 2021 13:57:14 +0800 Subject: [PATCH 2/2] fix terminal output on mac linux --- src/espIdfCustomTerminal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/espIdfCustomTerminal.ts b/src/espIdfCustomTerminal.ts index 18d286141..ec65dede8 100644 --- a/src/espIdfCustomTerminal.ts +++ b/src/espIdfCustomTerminal.ts @@ -46,7 +46,7 @@ export default class EspIdfCustomTerminal implements vscode.Pseudoterminal { formatText(text: string) { return process.platform === "win32" ? `${text.split(/\r?\n/g).join(EOL)}` - : `\r${text.split(/\r?\n/g).join("\r")}\r`; + : `\r${text.split(/(\r?\n)/g).join("\r")}\r`; } async handleInput(input: string) {