Skip to content

Commit ad03a04

Browse files
authored
Merge branch 'main' into seanmcm/1_27_0_changelog2
2 parents 004d880 + 5974720 commit ad03a04

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

Extension/package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,11 +4055,9 @@
40554055
"default": {}
40564056
},
40574057
"quoteArgs": {
4058-
"exceptions": {
4059-
"type": "boolean",
4060-
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
4061-
"default": true
4062-
}
4058+
"type": "boolean",
4059+
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
4060+
"default": true
40634061
}
40644062
}
40654063
},
@@ -4841,11 +4839,9 @@
48414839
"default": {}
48424840
},
48434841
"quoteArgs": {
4844-
"exceptions": {
4845-
"type": "boolean",
4846-
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
4847-
"default": true
4848-
}
4842+
"type": "boolean",
4843+
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
4844+
"default": true
48494845
}
48504846
}
48514847
},

Extension/src/Debugger/attachToProcess.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export class RemoteAttachPicker {
8181

8282
const pipeCmd: string = `"${pipeProgram}" ${argList}`;
8383

84-
processes = await this.getRemoteOSAndProcesses(pipeCmd);
84+
// If unspecified quoteArgs defaults to true.
85+
const quoteArgs: boolean = pipeTransport.quoteArgs ?? true;
86+
87+
processes = await this.getRemoteOSAndProcesses(pipeCmd, quoteArgs);
8588
} else if (!pipeTransport && useExtendedRemote) {
8689
if (!miDebuggerPath || !miDebuggerServerAddress) {
8790
throw new Error(localize("debugger.path.and.server.address.required", "{0} in debug configuration requires {1} and {2}", "useExtendedRemote", "miDebuggerPath", "miDebuggerServerAddress"));
@@ -106,7 +109,7 @@ export class RemoteAttachPicker {
106109
}
107110

108111
// Creates a string to run on the host machine which will execute a shell script on the remote machine to retrieve OS and processes
109-
private getRemoteProcessCommand(): string {
112+
private getRemoteProcessCommand(quoteArgs: boolean): string {
110113
let innerQuote: string = `'`;
111114
let outerQuote: string = `"`;
112115
let parameterBegin: string = `$(`;
@@ -127,6 +130,12 @@ export class RemoteAttachPicker {
127130
innerQuote = `"`;
128131
outerQuote = `'`;
129132
}
133+
134+
// If the pipeTransport settings indicate "quoteArgs": "false", we need to skip the outer quotes.
135+
if (!quoteArgs) {
136+
outerQuote = ``;
137+
}
138+
130139
// Also use a full path on Linux, so that we can use transports that need a full path such as 'machinectl' to connect to nspawn containers.
131140
if (os.platform() === "linux") {
132141
shPrefix = `/bin/`;
@@ -138,9 +147,9 @@ export class RemoteAttachPicker {
138147
`then ${PsProcessParser.psDarwinCommand}; fi${innerQuote}${outerQuote}`;
139148
}
140149

141-
private async getRemoteOSAndProcesses(pipeCmd: string): Promise<AttachItem[]> {
150+
private async getRemoteOSAndProcesses(pipeCmd: string, quoteArgs: boolean): Promise<AttachItem[]> {
142151
// Do not add any quoting in execCommand.
143-
const execCommand: string = `${pipeCmd} ${this.getRemoteProcessCommand()}`;
152+
const execCommand: string = `${pipeCmd} ${this.getRemoteProcessCommand(quoteArgs)}`;
144153

145154
const output: string = await util.execChildProcess(execCommand, undefined, this._channel);
146155
// OS will be on first line

Extension/tools/OptionsSchema.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@
4747
"default": {}
4848
},
4949
"quoteArgs": {
50-
"exceptions": {
51-
"type": "boolean",
52-
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
53-
"default": true
54-
}
50+
"type": "boolean",
51+
"description": "%c_cpp.debuggers.pipeTransport.quoteArgs.description%",
52+
"default": true
5553
}
5654
}
5755
},

0 commit comments

Comments
 (0)