Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix terminal output close bugs #291

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/build/buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class BuildTask {
}
this.building(true);
const modifiedEnv = appendIdfAndToolsToPath();
await ensureDir(this.curWorkspace);
const canAccessCMake = await isBinInPath(
"cmake",
this.curWorkspace,
Expand All @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion src/espIdfCustomTerminal.ts
Original file line number Diff line number Diff line change
@@ -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<string>();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down