Skip to content

Commit d3aea33

Browse files
committed
Change exec to spawn to make CodeQL happy
1 parent d0ee087 commit d3aea33

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/utils.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as vscode from "vscode";
66
import { ILogger } from "../src/logging";
77
import { IPowerShellExtensionClient } from "../src/features/ExternalApi";
88
import { resolveCliArgsFromVSCodeExecutablePath } from "@vscode/test-electron";
9-
import { execSync, spawnSync } from "child_process";
9+
import { spawnSync } from "child_process";
1010
import { existsSync } from "fs";
1111

1212
// This lets us test the rest of our path assumptions against the baseline of
@@ -154,8 +154,17 @@ export async function InstallCSharpExtension() {
154154
export function BuildBinaryModuleMock() {
155155
console.log("==BUILDING: Binary Module Mock==");
156156
const projectPath = path.resolve(`${__dirname}/../../test/mocks/BinaryModule/BinaryModule.csproj`); //Relative to "out/test" when testing.
157-
const buildResult = execSync(`dotnet publish ${projectPath}`);
158-
console.log(buildResult.toString());
157+
const dotnetArgs = [
158+
"publish",
159+
projectPath
160+
];
161+
const buildResult = spawnSync("dotnet", dotnetArgs, {
162+
encoding: "utf-8",
163+
windowsHide: true
164+
});
165+
if (buildResult.status !== 0) {
166+
throw new Error(`Failed to build binary module mock: ${buildResult.stderr}`);
167+
}
159168
}
160169

161170
/** Waits until the registered vscode event is fired and returns the trigger result of the event.

0 commit comments

Comments
 (0)