Skip to content

Commit 8c2c25e

Browse files
author
Dave Bartolomeo
committed
Fix PR feedback
1 parent da3f482 commit 8c2c25e

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

extensions/ql-vscode/src/cli.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@ export class CodeQLCliServer implements Disposable {
448448
// Spawn the CodeQL process
449449
const codeqlPath = await this.getCodeQlPath();
450450
const childPromise = spawn(codeqlPath, args);
451+
// Avoid a runtime message about unhandled rejection.
452+
childPromise.catch(() => {
453+
/**/
454+
});
455+
451456
const child = childPromise.childProcess;
452457

453458
let cancellationRegistration: Disposable | undefined = undefined;
@@ -469,13 +474,9 @@ export class CodeQLCliServer implements Disposable {
469474
])) {
470475
yield event;
471476
}
477+
478+
await childPromise;
472479
} finally {
473-
try {
474-
await childPromise;
475-
} catch (_e) {
476-
// We need to await this to avoid an unhandled rejection, but we want to propagate the
477-
// original exception.
478-
}
479480
if (cancellationRegistration !== undefined) {
480481
cancellationRegistration.dispose();
481482
}

extensions/ql-vscode/src/test-adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
261261
].join("\n")
262262
: [
263263
"",
264-
`${event.failureStage?.toLowerCase()} error: ${event.test}`,
264+
`${event.failureStage?.toLowerCase() ?? "unknown stage"} error: ${
265+
event.test
266+
}`,
265267
event.failureDescription ||
266268
`${event.messages[0].severity}: ${event.messages[0].message}`,
267269
"",

extensions/ql-vscode/src/test-manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class TestManager extends TestManagerBase {
155155
if (node.uri === undefined || node.uri.scheme !== "file") {
156156
throw new Error("Selected test is not a CodeQL test.");
157157
}
158-
return node.uri!.fsPath;
158+
return node.uri.fsPath;
159159
}
160160

161161
/** Start tracking tests in the specified workspace folders. */
@@ -256,9 +256,9 @@ export class TestManager extends TestManagerBase {
256256
const testRun = this.testController.createTestRun(request, undefined, true);
257257
try {
258258
const tests: string[] = [];
259-
testsToRun.forEach((t) => {
260-
testRun.enqueued(t);
261-
tests.push(t.uri!.fsPath);
259+
testsToRun.forEach((testItem, testPath) => {
260+
testRun.enqueued(testItem);
261+
tests.push(testPath);
262262
});
263263

264264
const logger = new TestRunLogger(testRun);

0 commit comments

Comments
 (0)