Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

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

  • Build tasks now terminate promptly with a non-zero exit code instead of leaving the terminal spinner active when early validation fails.

The following changes are proposed:

  • Ensure CustomBuildTaskTerminal.runBuildTask closes the pseudoterminal when project acquisition or preset compatibility fails before launching cmake.

The purpose of this change

Prevent CMake build tasks invoked via tasks.json from stalling when prerequisites are not met.

Other Notes/Information

Example guard added to close the task terminal on early failure:

if (!project || !await this.isTaskCompatibleWithPresets(project)) {
    if (doCloseEmitter) {
        this.closeEmitter.fire(-1);
    }
    return -1;
}
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: Build through 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:

Executing task: build native libs

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

[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --version
[proc]   with environment: {"ALLUSERSPROFILE":"C:\\ProgramData","ANDROID_HOME":"E:\\Tools\\Android\\sdk","APPDATA":"C:\\Users\\phill\\AppData\\Roaming","COMPUTERNAME":"FORDRING","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DEPOT_TOOLS_WIN_TOOLCHAIN":"0","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","ELECTRON_RUN_AS_NODE":"1","FBX_SDK_2019_2":"C:\\Program Files\\Autodesk\\FBX\\FBX SDK\\2019.2","FPS_BROWSER_APP_PROFILE_STRING":"Internet Explorer","FPS_BROWSER_USER_PROFILE_STRING":"Default","FXC2_DIR":"C:\\Program Files (x86)\\NVIDIA Corporation\\FX Composer 2.5","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\phill","LOCALAPPDATA":"C:\\Users\\phill\\AppData\\Local","LOGONSERVER":"\\\\FORDRING","NUMBER_OF_PROCESSORS":"24","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","OculusBase":"C:\\Program Files\\Oculus\\","OneDrive":"C:\\Users\\phill\\OneDrive","OneDriveConsumer":"C:\\Users\\phill\\OneDrive","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"AMD64 Family 25 Model 97 Stepping 2, AuthenticAMD","PROCESSOR_LEVEL":"25","PROCESSOR_REVISION":"6102","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules","PUBLIC":"C:\\Users\\Public","PYTHON_ROOT":"C:\\Program Files (x86)\\Python\\2.4\\","Path":"C:\\Program Files\\VulkanSDK\\1.4.309.0\\Bin;C:\\Program Files\\Oculus\\Support\\oculus-runtime;C:\\Program Files\\Eclipse Foundation\\jdk-8.0.302.8-hotspot\\bin;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\azcopy;C:\\Program Files\\Python\\3.6\\;C:\\Program Files\\Python\\3.6\\Scripts\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files\\dotnet\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;E:\\Tools\\flutter\\bin;C:\\Program Files\\...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes microsoft/vscode-cmake-tools#4563

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CMake build task stalling in version 1.21.36 Jan 30, 2026
Copilot AI requested a review from hanniavalera January 30, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants