microsoft / microsoft/vscode-cmake-tools

Launch Target doesn't initialise the shell as per the user's config

Open
#3,921 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: debug/launch more info needed
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

Brief Issue Summary

In my case, I'm using MSYS2 for my default terminal:

    "terminal.integrated.profiles.windows": {
        "MSYS2": {
            "path": "C:/Tools/msys64/usr/bin/bash.exe",
            "label": "MSYS2",
            "args": ["--login", "-i"],
            "env": {
                "MSYSTEM": "MSYS2",
                "CHERE_INVOKING": "1",
                "MSYS2_PATH_TYPE": "inherit"
            }
        },
    },
    "terminal.integrated.defaultProfile.windows": "MSYS2",

I rely on these arguments in order to pick the correct MSYS shell and to bring over the path variables (especially important for running my program after compiling, as without "inherit" being defined the path starts from a flash slate).

It seems like CMake Tools only retrieves and utilises the shell path, ignoring the rest of the user's configuration for that shell. I haven't found any means to configure this and it essentially renders the Launch Target feature useless for anyone who has a non-trivial shell setup.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

The terminal instance created by Launch Target:

ic2000@Win11 MSYS ~
$ "C:/Users/ic2000/Documents/Projects/Test/build/Release/src/test.exe"
C:/Users/ic2000/Documents/Projects/Test/build/Release/src/test.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

The terminal instance created by VS Code, properly utilising my terminal configuration:

ic2000@Win11 MSYS2 ~
$ "C:/Users/ic2000/Documents/Projects/Test/build/Release/src/test.exe"
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)

https://github.com/microsoft/vscode-cmake-tools/commit/d9557e68f4b08983414ef45ea08caa8523c68f28 is how I've personally got around this for the meantime.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Launch Target terminal setup and the workaround commit d9557e68f4b08983414ef45ea08caa8523c68f28. Reproduce the issue with the MSYS2 profile shown in the report, then verify that Launch Target honors the configured shell arguments and environment variables, including MSYSTEM, CHERE_INVOKING, and MSYS2_PATH_TYPE.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.