Skip to content

Commit

Permalink
lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
elahehrashedi authored and elahehrashedi committed Aug 13, 2021
1 parent 9f1dc09 commit 78638be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Extension/src/LanguageServer/cppBuildTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/* eslint-disable no-unused-expressions */
import * as path from 'path';
import {
TaskDefinition, Task, TaskGroup, ShellExecution, Uri, workspace,
Expand Down Expand Up @@ -361,7 +362,7 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
this.args.forEach((value, index) => {
value = util.normalizeArg(util.resolveVariables(value));
activeCommand = activeCommand + " " + value;
this.args[index]= value;
this.args[index] = value;
});
if (this.options) {
this.options.shell = true;
Expand All @@ -385,7 +386,7 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
let error: string = "";
let stdout: string = "";
let stderr: string = "";
let result: number = await new Promise<number>(resolve => {
const result: number = await new Promise<number>(resolve => {
if (child) {
child.on('error', err => {
splitWriteEmitter(err.message);
Expand Down Expand Up @@ -418,7 +419,7 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
}
}

private printBuildSummary(error: string, stdout: string, stderr: string) {
private printBuildSummary(error: string, stdout: string, stderr: string): void {
if (error) {
telemetry.logLanguageServerEvent("cppBuildTaskError");
this.writeEmitter.fire(localize("build.finished.with.error", "Build finished with error(s).") + this.endOfLine);
Expand Down
7 changes: 4 additions & 3 deletions Extension/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1311,13 +1311,14 @@ export function normalizeArg(arg: string): string {
// or includes escaped double-quotes,
// or includes unscaped single-quotes on mac and linux.
if (/^`.*`$/g.test(arg) || /.*\\".*/g.test(arg) ||
(!process.platform.includes("win") && /.*[^\\]'.*/g.test(arg))){
(!process.platform.includes("win") && /.*[^\\]'.*/g.test(arg))) {
return arg;
}
const unescapedSpaces = arg.split('').find((char, index) => index > 0 && char == " " && arg[index - 1] !== "\\");
const unescapedSpaces: string | undefined = arg.split('').find((char, index) => index > 0 && char === " " && arg[index - 1] !== "\\");
if (unescapedSpaces) {
arg = arg.replace(/\\\s/g," ").replace(/"/g, '\\"');
arg = arg.replace(/\\\s/g, " ").replace(/"/g, '\\"');
return "\"" + arg + "\"";
}
return arg;
}

0 comments on commit 78638be

Please sign in to comment.