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

Pass command line arguments for "Run Without Debugging" #924

Closed
DreamWaterFound opened this issue Nov 16, 2019 · 15 comments
Closed

Pass command line arguments for "Run Without Debugging" #924

DreamWaterFound opened this issue Nov 16, 2019 · 15 comments
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch
Milestone

Comments

@DreamWaterFound
Copy link

I'm so sorry to bother you with this little question ...

I know how to pass command line arguments to a debug target, but when I executed CMake: run without debugging, I found no argument was passed to the target. Did I miss any steps?

I will be very grateful to you if this problem was solved. Thank you.

@bobbrow bobbrow added enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch labels Nov 18, 2019
@bobbrow
Copy link
Member

bobbrow commented Nov 18, 2019

You did not miss any steps. This functionality has not been implemented. I will mark as a feature request.

@DreamWaterFound
Copy link
Author

Thank you for your reply!

Should I close this issue now, or should I keep it open until this new feature is implemented? (Sorry, I'm not familiar with the process of open source software maintenance)

@bobbrow
Copy link
Member

bobbrow commented Nov 19, 2019

Please leave it open. We will close it when the feature is implemented or if we don't think we can get to it in a reasonable time frame.

@bobbrow bobbrow changed the title Passing command line arguments to running a target without debug Pass command line arguments for "Run Without Debugging" Nov 19, 2019
@DreamWaterFound
Copy link
Author

Thanks! 👍

@bobbrow bobbrow added this to the Backlog milestone Feb 4, 2020
@fatfatson
Copy link

still not implemented today?

@bobbrow
Copy link
Member

bobbrow commented Apr 8, 2020

Not yet. If you want to take a look at the code, we'd accept a PR.

@ahmedshakill
Copy link

I am new using github. I need this feature too. would someone please accept this PR. It would great help
#1201

@PLUkraine
Copy link

Is this feature still in scope?

@MartinMajewski
Copy link

This is a bummer! Running without a debugger is not that uncommon, isn't it?
Especially, since the ssh-remote debugger has still issues, running without it is common practice for me. Having no way to pass arguments on startup is a show stopper for this the cmake tools.

Any workaround for this?

@andreeis
Copy link
Contributor

A good workaround is to use launch.json which can define program launch args and you can invoke the run without debugger via the command "Debug: Start without Debugging" in the pallette (as opposed to CMake: Run without debugging").
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": ["arg1", "arg2", "arg3"],
"stopAtEntry": false,
"cwd": "${command:cmake.launchTargetDirectory}",
"environment": [],
"console": "externalTerminal"
}
]
}

Regarding opened PRs, we are catching up on them this week. Thank you for your patience.

@andreeis
Copy link
Contributor

CMake Tools 1.7.0 was released today and it contains a fix for this issue. Upgrade the extension in VSCode and let us know if you encounter any other problems.

@JodiTheTigger
Copy link

For anyone trying to figure out how to actually do this, you need to add the args array to cmake.debugConfig in your settings.json

"cmake.debugConfig": {
    "args": [
        "-first", 
        "-second"
    ]
 }

@neel
Copy link

neel commented Sep 6, 2021

@JodiTheTigger Thanks. But I have multiple targets. Different targets need different set of arguments to run. How can I specify that target specific arguments ?

@JodiTheTigger
Copy link

@JodiTheTigger Thanks. But I have multiple targets. Different targets need different set of arguments to run. How can I specify that target specific arguments ?

Sounds like a new bug/feature request to me. I've given up using cmake launch without debugger, and moved back to running manually via the command line.

@bobbrow
Copy link
Member

bobbrow commented Sep 7, 2021

If you have multiple configurations that need different sets of arguments to run and you want to save those to a file so you don't have to type them out all the time, the solution is to use launch.json. More information here.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: debug/launch
Projects
None yet
Development

No branches or pull requests

9 participants