Handle early CMake task failures to avoid stalled build tasks #4679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses item
CMake build tasks could hang indefinitely when the project lookup failed or the task was incompatible with presets.
This changes visible behavior
The following changes are proposed:
CustomBuildTaskTerminal.runBuildTaskcloses the pseudoterminal when project acquisition or preset compatibility fails before launching cmake.The purpose of this change
Prevent CMake build tasks invoked via
tasks.jsonfrom stalling when prerequisites are not met.Other Notes/Information
Example guard added to close the task terminal on early failure:
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug] Can't start CMake build from task in 1.21.36+ (worked in 1.20.53)</issue_title>
<issue_description>### Brief Issue Summary
Running
CMake: Buildthrough the vscode UI works as expected.Running this task, however, stalls forever:
{ "label": "build native libs", "type": "cmake", "command": "build", "group": "build", "problemMatcher": "$gcc" },When I say "stalls" I mean the output terminal prints the following and then nothing else happens, except the "busy" indicator on the terminal tab keeps spinning forever:
Downgrading to 1.20.53 fixes the issue. Upgrading to the prerelease (1.22.7) does not fix the issue.
If I get a chance to try to sit down and make a minimal repro of this I will, but it probly won't be soon.
CMake Tools Diagnostics
{ "os": "win32", "vscodeVersion": "1.103.2", "cmtVersion": "1.21.36", "configurations": [ { "folder": "e:\\Projects\\BitSaber\\Tools", "cmakeVersion": "3.31.6", "configured": true, "generator": "Visual Studio 17 2022", "usesPresets": false, "compilers": {} }, { "folder": "e:\\Projects\\BitSaber\\Content", "cmakeVersion": "3.31.6", "configured": false, "generator": "", "usesPresets": false, "compilers": {} } ], "cpptoolsIntegration": { "isReady": true, "hasCodeModel": true, "activeBuildType": "Debug", "buildTypesSeen": [ "Debug", "Release", "MinSizeRel", "RelWithDebInfo" ], "requests": [], "responses": [], "partialMatches": [], "targetCount": 5, "executablesCount": 0, "librariesCount": 3, "targets": [ { "name": "ALL_BUILD", "type": "UTILITY" }, { "name": "Cobalt.Content.Native", "type": "SHARED_LIBRARY" }, { "name": "SPIRV-Reflect", "type": "STATIC_LIBRARY" }, { "name": "ZERO_CHECK", "type": "UTILITY" }, { "name": "lz4", "type": "STATIC_LIBRARY" } ] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": false }, { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": false } ] }Debug Log