Skip to content

Commit b0a4dba

Browse files
committed
Fix: Move remote attach check before findProcessByProgramName call
Per Sean's feedback, check for remote attach scenarios before calling findProcessByProgramName to avoid unnecessary function calls and potential errors for remote attach users.
1 parent 2e2e235 commit b0a4dba

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

Extension/src/Debugger/configurationProvider.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
356356
if (config.request === "attach" && !config.processId) {
357357
let processId: string | undefined;
358358

359-
// If program is specified, try to find the matching process by name
360-
if (config.program) {
361-
processId = await this.findProcessByProgramName(config.program, config, token);
359+
// If program is specified and not remote attach, try to find the matching process by name
360+
if (config.program && !config.pipeTransport && !config.useExtendedRemote) {
361+
processId = await this.findProcessByProgramName(config.program, token);
362362
}
363363

364364
// Fall back to process picker if program wasn't specified or didn't match
@@ -1170,14 +1170,8 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
11701170

11711171
private async findProcessByProgramName(
11721172
programPath: string,
1173-
config: CppDebugConfiguration,
11741173
token?: vscode.CancellationToken
11751174
): Promise<string | undefined> {
1176-
// Remote attach is not supported for program-based matching
1177-
if (config.pipeTransport || config.useExtendedRemote) {
1178-
return undefined;
1179-
}
1180-
11811175
// Validate that the program path is valid
11821176
if (!await util.checkExecutableWithoutExtensionExists(programPath)) {
11831177
return undefined;

0 commit comments

Comments
 (0)