Skip to content

Run without debugging#14351

Open
bobbrow wants to merge 11 commits intomainfrom
bobbrow/runWithoutDebugging
Open

Run without debugging#14351
bobbrow wants to merge 11 commits intomainfrom
bobbrow/runWithoutDebugging

Conversation

@bobbrow
Copy link
Copy Markdown
Member

@bobbrow bobbrow commented Apr 3, 2026

Fixes: #1201

Supports both the Play button in the editor (run active file) and configurations specified in launch.json. macOS support needs to be tested - I don't currently have access to a machine.

Co-authored by GitHub Copilot

@github-project-automation github-project-automation bot moved this to Pull Request in cpptools Apr 3, 2026
@bobbrow bobbrow marked this pull request as ready for review April 4, 2026 00:05
@bobbrow bobbrow requested a review from a team as a code owner April 4, 2026 00:05
@bobbrow bobbrow added this to the 1.32 milestone Apr 4, 2026
@sean-mcmanus sean-mcmanus modified the milestones: 1.32, 1.32.0 Apr 4, 2026
@bobbrow
Copy link
Copy Markdown
Member Author

bobbrow commented Apr 6, 2026

@WardenGnaw had some feedback about dealing with some of the other properties in the launch.json config and shared a commit in MIEngine where these things might have been handled. The cases where the config asks for something other than a local launch of a program should be handled in some way (either fail the launch session or fall back to regular debugging mode).

};
}

suite('Run Without Debugging Integration Test', function (): void {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be with other tests somewhere (other than common.ts)?

assert.fail(`Unsupported test platform: ${process.platform}`);
}

async function createBreakpointAtReturnStatement(sourceUri: vscode.Uri): Promise<vscode.SourceBreakpoint> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe debugger related helpers should go in Debugger\utils.ts ?

assert.strictEqual(util.hasMsvcEnvironment(), true, 'MSVC environment not set correctly.');
}

async function compileProgram(workspacePath: string, sourcePath: string, outputPath: string): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about other needed compiler args?

We also kick off builds in cppBuildTaskProvider.ts . It considers some other details there, such as other compiler args and ensuring ansi color coding is used in the output (which we could also get if we fixed #9681 , so we could use node-pty ).


function runProcess(command: string, args: string[], cwd: string, env?: NodeJS.ProcessEnv): Promise<ProcessResult> {
return new Promise((resolve, reject) => {
const child = cp.spawn(command, args, { cwd, env });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're quoting args and using spawn, you'll probably want to pass shell: true. Default would be false, and it wouldn't expect there to be escaping/quoting. We also have spawnChildProcess and execChildProcess. There is also direct use of exec after the call to buildShellCommandLine in cppBuildTaskProvider.ts.

I remember dealing with the whole shell-escaping can of worms once upon a time, and at least one additional spawn codepath (In Garrett's Process.ts) has snuck in since. I believe the right expectation is:

  • If we receive a command line from a user, that is a shell concept and must already contain shell quoting/escaping if required. We shouldn't add/remove quoting/escaping if we need to pass it on as a shell command line. If we need to parse it into individual args, we need to remove the quoting/escaping.
  • If we receive individual arguments (in an array), that is not a shell concept, and those arguments should not contain shell quoting/escaping. If we need to pass it on a command line through a shell, we need to add quoting/escaping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

Support "Run without debugging"

4 participants