Skip to content

[BUG] C++ Cling Custom Arguments ignored due to Variable Mismatch and Duplicate Flag Injection #440

@Erde321

Description

@Erde321

Description:
There is a bug in the C++ execution logic where custom arguments defined in the plugin settings are not passed to the Cling interpreter. Additionally, the C++ standard flag is being injected twice into the command call. Furthermore, the argument list grows cumulatively with every execution of the same code block

Steps to Reproduce:

  1. Go to settings and enter a custom flag (e.g., -I/custom/path) in the "Cling arguments for C++" field
  2. Instead of the actual Cling path, set the "Cling path" setting to a simple helper program that prints all command-line arguments it receives. This allows you to see exactly what string the plugin constructs.
  3. Run the code block.
  4. Observe that the custom flag is missing, while the standard flag is duplicated.
  5. Run the code block again.
  6. Observe a longer args list.

Observed Behavior:
I used a test program to print all arguments passed to the process. The output shows that the custom arguments from the settings are completely ignored. Instead, the output looks like this:

"
Parameter 1: -std=c++2a
Parameter 2: -std=c++2a
Parameter 3:
...
Parameter 7: #include
... (rest of the code block)
"

My guess:
In src/settings/per-lang/makeCppSettings.ts, the UI saves the input to tab.plugin.settings.cppArgs.
However, in src/RunButton.ts, the execution logic for C++ attempts to read s.clingArgs:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions