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

add try catch and attempt to grab specifically the json #3868

Merged
merged 6 commits into from
Jul 10, 2024
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# What's New?

## 1.19.0
## 1.19

Bug Fixes:

- Fix issue where `cmake.preferredGenerators` wasn't falling back to the next entry when the first entry didn't exist [#2709](https://github.com/microsoft/vscode-cmake-tools/issues/2709)
- Potential fix for attempting to load a non-variants file as a variants file and throwing a parse exception [#3727](https://github.com/microsoft/vscode-cmake-tools/issues/3727)
- Fix edge case where parsing tests fails when additional output is printed before tests json. [#3750](https://github.com/microsoft/vscode-cmake-tools/issues/3750)
- Fix issue where `Configure with CMake Debugger` fails on restart because the previously used pipe to CMake Debugger is no longer available. [#3582](https://github.com/microsoft/vscode-cmake-tools/issues/3582)

## 1.18.43
Expand Down
8 changes: 7 additions & 1 deletion src/ctest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,13 @@ export class CTestDriver implements vscode.Disposable {
log.error(localize('ctest.error', 'There was an error running ctest to determine available test executables'));
return result.retc || -3;
}
this.tests = JSON.parse(result.stdout) ?? undefined;

try {
this.tests = JSON.parse(result.stdout.slice(result.stdout.indexOf("{"))) ?? undefined;
} catch {
this.tests = undefined;
}

if (this.tests && this.tests.kind === 'ctestInfo') {
this.tests.tests.forEach(test => {
let testDefFile: string | undefined;
Expand Down
Loading